summaryrefslogtreecommitdiffstats
path: root/tools/src/h5diff
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-10-20 13:35:17 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-10-20 13:35:17 (GMT)
commit2fa9d84b12e769331fc7bd6efdde46347dd676c6 (patch)
treec4d17414126e670dfa425bb89d1750177104020d /tools/src/h5diff
parent8a391887be263e0ba7f1ba659dcf6559b5a5e01a (diff)
parent18ba8cb7d247cc2f535e53d66c2a47740724de6a (diff)
downloadhdf5-2fa9d84b12e769331fc7bd6efdde46347dd676c6.zip
hdf5-2fa9d84b12e769331fc7bd6efdde46347dd676c6.tar.gz
hdf5-2fa9d84b12e769331fc7bd6efdde46347dd676c6.tar.bz2
Merge pull request #713 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
* commit '18ba8cb7d247cc2f535e53d66c2a47740724de6a': Windows cannot share files easily Avoid double free Windows had issues - revert code changes for get_option Remove extra command line Correct name of file Add Mask test to script Add new output files to clear test Correct name of err file Fix name of output files Fix format convert error mask test Fix tools error handling and valgrind issues Fix error handling issues Correct test results Cleanup valgrind issues HDFFV-1097 Changed file columns HDFFV-10297 add h5copy test and fix h5diff errors Fix VS2012 declaration error HDFFV-10297 Fix compiler compaliants HDFFV-10296 Update tools lib to use the error handling macros. Close ids in loop
Diffstat (limited to 'tools/src/h5diff')
-rw-r--r--tools/src/h5diff/h5diff_common.c82
-rw-r--r--tools/src/h5diff/h5diff_common.h4
-rw-r--r--tools/src/h5diff/h5diff_main.c12
-rw-r--r--tools/src/h5diff/ph5diff_main.c18
4 files changed, 58 insertions, 58 deletions
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index e4696c0..532169f 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -52,7 +52,7 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void check_options(diff_opt_t* options)
+static void check_options(diff_opt_t* opts)
{
/*--------------------------------------------------------------
* check for mutually exclusive options
@@ -61,7 +61,7 @@ static void check_options(diff_opt_t* options)
/* check between -d , -p, --use-system-epsilon.
* These options are mutually exclusive.
*/
- if ((options->d + options->p + options->use_system_epsilon) > 1) {
+ if ((opts->d + opts->p + opts->use_system_epsilon) > 1) {
printf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME);
printf("use no more than one.\n");
printf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME);
@@ -84,27 +84,27 @@ void parse_command_line(int argc,
const char** fname2,
const char** objname1,
const char** objname2,
- diff_opt_t* options)
+ diff_opt_t* opts)
{
int i;
int opt;
struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node;
/* process the command-line */
- memset(options, 0, sizeof (diff_opt_t));
+ memset(opts, 0, sizeof (diff_opt_t));
/* assume equal contents initially */
- options->contents = 1;
+ opts->contents = 1;
/* NaNs are handled by default */
- options->do_nans = 1;
+ opts->do_nans = 1;
/* not Listing objects that are not comparable */
- options->m_list_not_cmp = 0;
+ opts->m_list_not_cmp = 0;
/* initially no not-comparable. */
/**this is bad in mixing option with results**/
- options->not_cmp=0;
+ opts->not_cmp=0;
/* init for exclude-path option */
exclude_head = NULL;
@@ -125,7 +125,7 @@ void parse_command_line(int argc,
h5diff_exit(EXIT_SUCCESS);
case 'v':
- options->m_verbose = 1;
+ opts->m_verbose = 1;
/* This for loop is for handling style like
* -v, -v1, --verbose, --verbose=1.
*/
@@ -135,11 +135,11 @@ void parse_command_line(int argc,
*/
if (!strcmp (argv[i], "-v")) { /* no arg */
opt_ind--;
- options->m_verbose_level = 0;
+ opts->m_verbose_level = 0;
break;
}
else if (!strncmp (argv[i], "-v", (size_t)2)) {
- options->m_verbose_level = atoi(&argv[i][2]);
+ opts->m_verbose_level = atoi(&argv[i][2]);
break;
}
@@ -147,11 +147,11 @@ void parse_command_line(int argc,
* long opt
*/
if (!strcmp (argv[i], "--verbose")) { /* no arg */
- options->m_verbose_level = 0;
+ opts->m_verbose_level = 0;
break;
}
else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') {
- options->m_verbose_level = atoi(&argv[i][10]);
+ opts->m_verbose_level = atoi(&argv[i][10]);
break;
}
}
@@ -159,19 +159,19 @@ void parse_command_line(int argc,
case 'q':
/* use quiet mode; supress the message "0 differences found" */
- options->m_quiet = 1;
+ opts->m_quiet = 1;
break;
case 'r':
- options->m_report = 1;
+ opts->m_report = 1;
break;
case 'l':
- options->follow_links = TRUE;
+ opts->follow_links = TRUE;
break;
case 'x':
- options->no_dangle_links = 1;
+ opts->no_dangle_links = 1;
break;
case 'S':
@@ -179,7 +179,7 @@ void parse_command_line(int argc,
break;
case 'E':
- options->exclude_path = 1;
+ opts->exclude_path = 1;
/* create linked list of excluding objects */
if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
@@ -206,64 +206,64 @@ void parse_command_line(int argc,
break;
case 'd':
- options->d=1;
+ opts->d=1;
if (check_d_input(opt_arg) == - 1) {
printf("<-d %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- options->delta = atof(opt_arg);
+ opts->delta = atof(opt_arg);
/* -d 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(options->delta, (double)0.0F))
- options->d=0;
+ if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
+ opts->d=0;
break;
case 'p':
- options->p=1;
+ opts->p=1;
if (check_p_input(opt_arg) == -1) {
printf("<-p %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- options->percent = atof(opt_arg);
+ opts->percent = atof(opt_arg);
/* -p 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(options->percent, (double)0.0F))
- options->p = 0;
+ if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
+ opts->p = 0;
break;
case 'n':
- options->n=1;
+ opts->n=1;
if ( check_n_input(opt_arg) == -1) {
printf("<-n %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- options->count = HDstrtoull(opt_arg, NULL, 0);
+ opts->count = HDstrtoull(opt_arg, NULL, 0);
break;
case 'N':
- options->do_nans = 0;
+ opts->do_nans = 0;
break;
case 'c':
- options->m_list_not_cmp = 1;
+ opts->m_list_not_cmp = 1;
break;
case 'e':
- options->use_system_epsilon = 1;
+ opts->use_system_epsilon = 1;
break;
}
}
/* check options */
- check_options(options);
+ check_options(opts);
/* if exclude-path option is used, keep the exclude path list */
- if (options->exclude_path)
- options->exclude = exclude_head;
+ if (opts->exclude_path)
+ opts->exclude = exclude_head;
/* check for file names to be processed */
if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) {
@@ -300,23 +300,23 @@ void parse_command_line(int argc,
*-------------------------------------------------------------------------
*/
- void print_info(diff_opt_t* options)
+ void print_info(diff_opt_t* opts)
{
- if (options->m_quiet || options->err_stat)
+ if (opts->m_quiet || opts->err_stat)
return;
- if (options->cmn_objs == 0) {
+ if (opts->cmn_objs == 0) {
printf("No common objects found. Files are not comparable.\n");
- if (!options->m_verbose)
+ if (!opts->m_verbose)
printf("Use -v for a list of objects.\n");
}
- if (options->not_cmp == 1) {
- if (options->m_list_not_cmp == 0) {
+ if (opts->not_cmp == 1) {
+ if (opts->m_list_not_cmp == 0) {
printf("--------------------------------\n");
printf("Some objects are not comparable\n");
printf("--------------------------------\n");
- if (options->m_verbose)
+ if (opts->m_verbose)
printf("Use -c for a list of objects without details of differences.\n");
else
printf("Use -c for a list of objects.\n");
diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h
index e5dfe3f..dc0676c 100644
--- a/tools/src/h5diff/h5diff_common.h
+++ b/tools/src/h5diff/h5diff_common.h
@@ -23,9 +23,9 @@ extern "C" {
#endif
void usage(void);
-void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options);
+void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts);
void h5diff_exit(int status);
-void print_info(diff_opt_t* options);
+void print_info(diff_opt_t* opts);
#ifdef __cplusplus
}
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index 8dab3b4..ad488a4 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -78,7 +78,7 @@ int main(int argc, const char *argv[])
const char *objname1 = NULL;
const char *objname2 = NULL;
hsize_t nfound=0;
- diff_opt_t options;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -98,7 +98,7 @@ int main(int argc, const char *argv[])
* process the command-line
*-------------------------------------------------------------------------
*/
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
if (enable_error_stack) {
H5Eset_auto2(H5E_DEFAULT, func, edata);
@@ -110,9 +110,9 @@ int main(int argc, const char *argv[])
*-------------------------------------------------------------------------
*/
- nfound = h5diff(fname1, fname2, objname1, objname2, &options);
+ nfound = h5diff(fname1, fname2, objname1, objname2, &opts);
- print_info(&options);
+ print_info(&opts);
/*-------------------------------------------------------------------------
* exit code
@@ -123,11 +123,11 @@ int main(int argc, const char *argv[])
ret = (nfound == 0 ? 0 : 1);
/* if graph difference return 1 for differences */
- if (options.contents == 0)
+ if (opts.contents == 0)
ret = 1;
/* and return 2 for error */
- if (options.err_stat)
+ if (opts.err_stat)
ret = 2;
h5diff_exit(ret);
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index 89efc39..83240cb 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -50,7 +50,7 @@ int main(int argc, const char *argv[])
const char *fname2 = NULL;
const char *objname1 = NULL;
const char *objname2 = NULL;
- diff_opt_t options;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -72,11 +72,11 @@ int main(int argc, const char *argv[])
g_Parallel = 0;
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
- h5diff(fname1, fname2, objname1, objname2, &options);
+ h5diff(fname1, fname2, objname1, objname2, &opts);
- print_info(&options);
+ print_info(&opts);
}
/* Parallel h5diff */
else {
@@ -84,13 +84,13 @@ int main(int argc, const char *argv[])
/* Have the manager process the command-line */
if(nID == 0)
{
- parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
- h5diff(fname1, fname2, objname1, objname2, &options);
+ h5diff(fname1, fname2, objname1, objname2, &opts);
MPI_Barrier(MPI_COMM_WORLD);
- print_info(&options);
+ print_info(&opts);
print_manager_output();
}
/* All other tasks become workers and wait for assignments. */
@@ -178,8 +178,8 @@ ph5diff_worker(int nID)
MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status);
/* Do the diff */
- diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.options), &(args.argdata));
- diffs.not_cmp = args.options.not_cmp;
+ diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.opts), &(args.argdata));
+ diffs.not_cmp = args.opts.not_cmp;
/* If print buffer has something in it, request print token.*/
if(outBuffOffset>0)