summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/h5repack.c30
-rw-r--r--tools/h5repack/h5repack_copy.c59
-rw-r--r--tools/h5repack/h5repack_filters.c1
-rw-r--r--tools/h5repack/h5repack_main.c41
-rw-r--r--tools/h5repack/h5repack_opttable.c12
-rw-r--r--tools/h5repack/h5repack_parse.c52
-rw-r--r--tools/h5repack/h5repack_verify.c26
-rw-r--r--tools/h5repack/h5repacktst.c5
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c7
9 files changed, 117 insertions, 116 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 8d10a57..da1fbf3 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -22,10 +22,6 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-
-extern char *progname;
-
-
/*-------------------------------------------------------------------------
* File: h5repack.c
* Purpose: Public API functions
@@ -160,7 +156,7 @@ int h5repack_addfilter(const char* str,
if(options->n_filter_g > H5_REPACK_MAX_NFILTERS)
{
- error_msg(progname, "maximum number of filters exceeded for <%s>\n", str);
+ error_msg("maximum number of filters exceeded for <%s>\n", str);
free(obj_list);
return -1;
}
@@ -198,7 +194,7 @@ int h5repack_addlayout(const char* str,
init_packobject(&pack);
if (options->all_layout==1){
- error_msg(progname, "invalid layout input: 'all' option \
+ error_msg("invalid layout input: 'all' option \
is present with other objects <%s>\n",str);
return -1;
}
@@ -617,7 +613,7 @@ static int check_options(pack_opt_t *options)
break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
- error_msg(progname, "invalid layout\n");
+ error_msg("invalid layout\n");
return -1;
default:
strcpy(slayout,"invalid layout\n");
@@ -658,7 +654,7 @@ static int check_options(pack_opt_t *options)
if (options->all_layout==1 && has_ck)
{
- error_msg(progname, "invalid chunking input: 'all' option\
+ error_msg("invalid chunking input: 'all' option\
is present with other objects\n");
return -1;
}
@@ -720,7 +716,7 @@ static int check_options(pack_opt_t *options)
if (options->all_filter==1 && has_cp)
{
- error_msg(progname, "invalid compression input: 'all' option\
+ error_msg("invalid compression input: 'all' option\
is present with other objects\n");
return -1;
}
@@ -732,24 +728,24 @@ static int check_options(pack_opt_t *options)
if (options->grp_compact < 0)
{
- error_msg(progname, "invalid maximum number of links to store as header messages\n");
+ error_msg("invalid maximum number of links to store as header messages\n");
return -1;
}
if (options->grp_indexed < 0)
{
- error_msg(progname, "invalid minimum number of links to store in the indexed format\n");
+ error_msg("invalid minimum number of links to store in the indexed format\n");
return -1;
}
if (options->grp_indexed > options->grp_compact)
{
- error_msg(progname, "minimum indexed size is greater than the maximum compact size\n");
+ error_msg("minimum indexed size is greater than the maximum compact size\n");
return -1;
}
for (i=0; i<8; i++)
{
if (options->msg_size[i]<0)
{
- error_msg(progname, "invalid shared message size\n");
+ error_msg("invalid shared message size\n");
return -1;
}
}
@@ -771,7 +767,7 @@ static int check_options(pack_opt_t *options)
if ( options->ublock_filename == NULL && options->ublock_size != 0 )
{
- error_msg(progname, "file name missing for user block\n",
+ error_msg("file name missing for user block\n",
options->ublock_filename);
return -1;
}
@@ -784,7 +780,7 @@ static int check_options(pack_opt_t *options)
if ( options->alignment == 0 && options->threshold != 0 )
{
- error_msg(progname, "alignment for H5Pset_alignment missing\n");
+ error_msg("alignment for H5Pset_alignment missing\n");
return -1;
}
@@ -856,7 +852,7 @@ static int check_objects(const char* fname,
/* 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",
+ error_msg("%s Could not find <%s> in file <%s>. Exiting...\n",
(options->verbose?"\n":""),name,fname);
goto out;
}
@@ -978,7 +974,7 @@ static const char* get_sfilter(H5Z_filter_t filtn)
else if (filtn==H5Z_FILTER_SCALEOFFSET)
return "SOFF";
else {
- error_msg(progname, "input error in filter type\n");
+ error_msg("input error in filter type\n");
exit(EXIT_FAILURE);
}
}
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 12fdabc..c3475aa 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -30,7 +30,6 @@
* globals
*-------------------------------------------------------------------------
*/
-extern char *progname;
/*-------------------------------------------------------------------------
* macros
@@ -90,7 +89,7 @@ int copy_objects(const char* fnamein,
*/
if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
{
- error_msg(progname, "<%s>: %s\n", fnamein, H5FOPENERROR );
+ error_msg("<%s>: %s\n", fnamein, H5FOPENERROR );
goto out;
}
@@ -100,13 +99,13 @@ int copy_objects(const char* fnamein,
if((fcpl_in = H5Fget_create_plist(fidin)) < 0)
{
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto out;
}
if(H5Pget_userblock(fcpl_in, &ub_size) < 0)
{
- error_msg(progname, "failed to retrieve userblock size\n");
+ error_msg("failed to retrieve userblock size\n");
goto out;
}
@@ -114,7 +113,7 @@ int copy_objects(const char* fnamein,
{
if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
{
- error_msg(progname, "failed to retrieve file space strategy\n");
+ error_msg("failed to retrieve file space strategy\n");
goto out;
}
}
@@ -123,14 +122,14 @@ int copy_objects(const char* fnamein,
{
if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
{
- error_msg(progname, "failed to retrieve file space threshold\n");
+ error_msg("failed to retrieve file space threshold\n");
goto out;
}
}
if(H5Pclose(fcpl_in) < 0)
{
- error_msg(progname, "failed to close property list\n");
+ error_msg("failed to close property list\n");
goto out;
}
}
@@ -141,7 +140,7 @@ int copy_objects(const char* fnamein,
/* Create file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- error_msg(progname, "fail to create a file creation property list\n");
+ error_msg("fail to create a file creation property list\n");
goto out;
}
@@ -149,7 +148,7 @@ int copy_objects(const char* fnamein,
{
if(H5Pset_userblock(fcpl, ub_size) < 0)
{
- error_msg(progname, "failed to set non-default userblock size\n");
+ error_msg("failed to set non-default userblock size\n");
goto out;
}
}
@@ -162,7 +161,7 @@ int copy_objects(const char* fnamein,
/* (So that it is created in "dense storage" form) */
if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0)
{
- error_msg(progname, "fail to adjust group creation parameters for root group\n");
+ error_msg("fail to adjust group creation parameters for root group\n");
goto out;
}
@@ -204,7 +203,7 @@ int copy_objects(const char* fnamein,
{
if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
{
- error_msg(progname, "fail to set the number of shared object header message indexes\n");
+ error_msg("fail to set the number of shared object header message indexes\n");
goto out;
}
@@ -212,7 +211,7 @@ int copy_objects(const char* fnamein,
for(i = 0; i < (nindex - 1); i++)
{
if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
- error_msg(progname, "fail to configure the specified shared object header message index\n");
+ error_msg("fail to configure the specified shared object header message index\n");
goto out;
} /* end if */
} /* end for */
@@ -221,13 +220,13 @@ int copy_objects(const char* fnamein,
/* Create file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
- error_msg(progname, "Could not create file access property list\n");
+ error_msg("Could not create file access property list\n");
goto out;
} /* end if */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
{
- error_msg(progname, "Could not set property for using latest version of the format\n");
+ error_msg("Could not set property for using latest version of the format\n");
goto out;
} /* end if */
} /* end if */
@@ -254,7 +253,7 @@ int copy_objects(const char* fnamein,
/* set user block size */
if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
{
- error_msg(progname, "failed to set userblock size\n");
+ error_msg("failed to set userblock size\n");
goto out;
}
@@ -266,14 +265,14 @@ int copy_objects(const char* fnamein,
/* create a file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- error_msg(progname, "fail to create a file creation property list\n");
+ error_msg("fail to create a file creation property list\n");
goto out;
}
/* set user block size */
if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
{
- error_msg(progname, "failed to set userblock size\n");
+ error_msg("failed to set userblock size\n");
goto out;
}
@@ -298,7 +297,7 @@ int copy_objects(const char* fnamein,
if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
{
- error_msg(progname, "failed to set alignment\n");
+ error_msg("failed to set alignment\n");
goto out;
}
@@ -310,13 +309,13 @@ int copy_objects(const char* fnamein,
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
- error_msg(progname, "Could not create file access property list\n");
+ error_msg("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");
+ error_msg("failed to set alignment\n");
goto out;
}
@@ -330,7 +329,7 @@ int copy_objects(const char* fnamein,
/* set file space strategy and free space threshold */
if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
- error_msg(progname, "failed to set file space strategy & threshold\n");
+ error_msg("failed to set file space strategy & threshold\n");
goto out;
}
}
@@ -339,14 +338,14 @@ int copy_objects(const char* fnamein,
/* create a file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- error_msg(progname, "fail to create a file creation property list\n");
+ error_msg("fail to create a file creation property list\n");
goto out;
}
/* set file space strategy and free space threshold */
if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
- error_msg(progname, "failed to set file space strategy & threshold \n");
+ error_msg("failed to set file space strategy & threshold \n");
goto out;
}
}
@@ -363,7 +362,7 @@ int copy_objects(const char* fnamein,
if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
- error_msg(progname, "<%s>: Could not create file\n", fnameout );
+ error_msg("<%s>: Could not create file\n", fnameout );
goto out;
}
@@ -376,7 +375,7 @@ int copy_objects(const char* fnamein,
{
if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 )
{
- error_msg(progname, "Could not copy user block. Exiting...\n");
+ error_msg("Could not copy user block. Exiting...\n");
goto out;
}
@@ -400,7 +399,7 @@ int copy_objects(const char* fnamein,
*/
if(do_copy_objects(fidin, fidout, travt, options) < 0)
{
- error_msg(progname, "<%s>: Could not copy data to: %s\n", fnamein, fnameout);
+ error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
} /* end if */
@@ -442,7 +441,7 @@ int copy_objects(const char* fnamein,
{
if ( copy_user_block(fnamein, fnameout, ub_size) < 0 )
{
- error_msg(progname, "Could not copy user block. Exiting...\n");
+ error_msg("Could not copy user block. Exiting...\n");
goto out;
}
@@ -1406,19 +1405,19 @@ void print_user_block(const char *filename, hid_t fid)
/* get user block size */
if(( fcpl = H5Fget_create_plist(fid)) < 0)
{
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto done;
}
if(H5Pget_userblock(fcpl, &ub_size) < 0)
{
- error_msg(progname, "failed to retrieve userblock size\n");
+ error_msg("failed to retrieve userblock size\n");
goto done;
}
if(H5Pclose(fcpl) < 0)
{
- error_msg(progname, "failed to close property list\n");
+ error_msg("failed to close property list\n");
goto done;
}
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index c7d8b1e..d4a3479 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -14,6 +14,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
+#include "h5test.h"
#include "h5tools.h"
/* number of members in an array */
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index a95c4c4..7d2fc62 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -20,6 +20,8 @@
#include "h5tools_utils.h"
#include "h5repack.h"
+/* Name of tool */
+#define PROGRAMNAME "h5repack"
static void usage(const char *prog);
static void parse_command_line(int argc, const char **argv, pack_opt_t* options);
@@ -27,8 +29,6 @@ static void read_info(const char *filename,pack_opt_t *options);
/* module-scoped variables */
-const char *progname = "h5repack";
-int d_status = EXIT_SUCCESS;
static int has_i_o = 0;
const char *infile = NULL;
const char *outfile = NULL;
@@ -107,6 +107,9 @@ int main(int argc, const char **argv)
pack_opt_t options; /*the global options */
int ret=-1;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* initialize options */
h5repack_init(&options, 0, 0, (hsize_t)0);
@@ -123,8 +126,8 @@ int main(int argc, const char **argv)
if ( strcmp( infile, outfile ) == 0 )
{
- error_msg(progname, "file names cannot be the same\n");
- usage(progname);
+ error_msg("file names cannot be the same\n");
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
@@ -132,8 +135,8 @@ int main(int argc, const char **argv)
else
{
- error_msg(progname, "file names missing\n");
- usage(progname);
+ error_msg("file names missing\n");
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
}
@@ -316,10 +319,10 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'h':
- usage(progname);
+ usage(h5tools_getprogname());
exit(EXIT_SUCCESS);
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
exit(EXIT_SUCCESS);
case 'v':
options->verbose = 1;
@@ -329,7 +332,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* parse the -f filter option */
if (h5repack_addfilter( opt_arg, options)<0)
{
- error_msg(progname, "in parsing filter\n");
+ error_msg("in parsing filter\n");
exit(EXIT_FAILURE);
}
break;
@@ -338,7 +341,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* parse the -l layout option */
if (h5repack_addlayout( opt_arg, options)<0)
{
- error_msg(progname, "in parsing layout\n");
+ error_msg("in parsing layout\n");
exit(EXIT_FAILURE);
}
break;
@@ -349,7 +352,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->min_comp = atoi( opt_arg );
if ((int)options->min_comp<=0)
{
- error_msg(progname, "invalid minimum compress size <%s>\n", opt_arg );
+ error_msg("invalid minimum compress size <%s>\n", opt_arg );
exit(EXIT_FAILURE);
}
break;
@@ -442,7 +445,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->alignment = atol( opt_arg );
if ( options->alignment < 1 )
{
- error_msg(progname, "invalid alignment size\n", opt_arg );
+ error_msg("invalid alignment size\n", opt_arg );
exit(EXIT_FAILURE);
}
break;
@@ -461,7 +464,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
else if(!strcmp(strategy, "VFD"))
options->fs_strategy = H5F_FILE_SPACE_VFD;
else {
- error_msg(progname, "invalid file space management strategy\n", opt_arg );
+ error_msg("invalid file space management strategy\n", opt_arg );
exit(EXIT_FAILURE);
}
break;
@@ -481,8 +484,8 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* check for file names to be processed */
if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
{
- error_msg(progname, "missing file names\n");
- usage(progname);
+ error_msg("missing file names\n");
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
}
@@ -515,7 +518,7 @@ void read_info(const char *filename,
int i, rc=1;
if ((fp = fopen(filename, "r")) == (FILE *)NULL) {
- error_msg(progname, "cannot open options file %s\n", filename);
+ error_msg("cannot open options file %s\n", filename);
exit(EXIT_FAILURE);
}
@@ -552,7 +555,7 @@ void read_info(const char *filename,
comp_info[i-1]='\0'; /*cut the last " */
if (h5repack_addfilter(comp_info,options)==-1){
- error_msg(progname, "could not add compression option\n");
+ error_msg("could not add compression option\n");
exit(EXIT_FAILURE);
}
}
@@ -582,7 +585,7 @@ void read_info(const char *filename,
comp_info[i-1]='\0'; /*cut the last " */
if (h5repack_addlayout(comp_info,options)==-1){
- error_msg(progname, "could not add chunck option\n");
+ error_msg("could not add chunck option\n");
exit(EXIT_FAILURE);
}
}
@@ -591,7 +594,7 @@ void read_info(const char *filename,
*-------------------------------------------------------------------------
*/
else {
- error_msg(progname, "bad file format for %s", filename);
+ error_msg("bad file format for %s", filename);
exit(EXIT_FAILURE);
}
}
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index 7c87359..50f97bd 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -18,8 +18,6 @@
#include "h5repack.h"
#include "h5tools_utils.h"
-extern char *progname;
-
/*-------------------------------------------------------------------------
* Function: init_packobject
*
@@ -67,7 +65,7 @@ static void aux_tblinsert_filter(pack_opttbl_t *table,
}
else
{
- error_msg(progname, "cannot insert the filter in this object.\
+ error_msg("cannot insert the filter in this object.\
Maximum capacity exceeded\n");
}
}
@@ -126,7 +124,7 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs )
table->size += n_objs;
table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t));
if (table->objs==NULL) {
- error_msg(progname, "not enough memory for options table\n");
+ error_msg("not enough memory for options table\n");
return -1;
}
for (i = table->nelems; i < table->size; i++)
@@ -153,7 +151,7 @@ int options_table_init( pack_opttbl_t **tbl )
if(NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t))))
{
- error_msg(progname, "not enough memory for options table\n");
+ error_msg("not enough memory for options table\n");
return -1;
}
@@ -161,7 +159,7 @@ int options_table_init( pack_opttbl_t **tbl )
table->nelems = 0;
if(NULL == (table->objs = (pack_info_t*)malloc(table->size * sizeof(pack_info_t))))
{
- error_msg(progname, "not enough memory for options table\n");
+ error_msg("not enough memory for options table\n");
free(table);
return -1;
}
@@ -232,7 +230,7 @@ int options_add_layout( obj_list_t *obj_list,
/* already chunk info inserted for this one; exit */
if (table->objs[i].chunk.rank>0)
{
- error_msg(progname, "chunk information already inserted for <%s>\n",obj_list[j].obj);
+ error_msg("chunk information already inserted for <%s>\n",obj_list[j].obj);
exit(EXIT_FAILURE);
}
/* insert the layout info */
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 2d8f040..d3a7419 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -21,8 +21,6 @@
#include "h5repack.h"
#include "h5tools_utils.h"
-extern char *progname;
-
/*-------------------------------------------------------------------------
* Function: parse_filter
*
@@ -98,7 +96,7 @@ obj_list_t* parse_filter(const char *str,
obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
{
- error_msg(progname, "could not allocate object list\n");
+ error_msg("could not allocate object list\n");
return NULL;
}
*n_objs=n;
@@ -121,7 +119,7 @@ obj_list_t* parse_filter(const char *str,
if (end_obj+1==(int)len)
{
if (obj_list) free(obj_list);
- error_msg(progname, "input Error: Invalid compression type in <%s>\n",str);
+ error_msg("input Error: Invalid compression type in <%s>\n",str);
exit(EXIT_FAILURE);
}
@@ -159,7 +157,7 @@ obj_list_t* parse_filter(const char *str,
c = str[u];
if (!isdigit(c) && l==-1){
if (obj_list) free(obj_list);
- error_msg(progname, "compression parameter not digit in <%s>\n",str);
+ error_msg("compression parameter not digit in <%s>\n",str);
exit(EXIT_FAILURE);
}
if (l==-1)
@@ -179,7 +177,7 @@ obj_list_t* parse_filter(const char *str,
filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
else
{
- error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
+ error_msg("szip mask must be 'NN' or 'EC' \n");
exit(EXIT_FAILURE);
}
@@ -219,7 +217,7 @@ obj_list_t* parse_filter(const char *str,
c = str[u];
if (!isdigit(c) && l==-1){
if (obj_list) free(obj_list);
- error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
+ error_msg("compression parameter is not a digit in <%s>\n",str);
exit(EXIT_FAILURE);
}
if (l==-1)
@@ -239,7 +237,7 @@ obj_list_t* parse_filter(const char *str,
filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE;
else
{
- error_msg(progname, "scale type must be 'IN' or 'DS' \n");
+ error_msg("scale type must be 'IN' or 'DS' \n");
exit(EXIT_FAILURE);
}
@@ -263,7 +261,7 @@ obj_list_t* parse_filter(const char *str,
c = str[u];
if (!isdigit(c)){
if (obj_list) free(obj_list);
- error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
+ error_msg("compression parameter is not a digit in <%s>\n",str);
exit(EXIT_FAILURE);
}
stype[m]=c;
@@ -309,7 +307,7 @@ obj_list_t* parse_filter(const char *str,
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);
+ error_msg("missing compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -325,7 +323,7 @@ obj_list_t* parse_filter(const char *str,
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);
+ error_msg("missing compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -341,7 +339,7 @@ obj_list_t* parse_filter(const char *str,
if (m>0)
{ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "extra parameter in SHUF <%s>\n",str);
+ error_msg("extra parameter in SHUF <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -356,7 +354,7 @@ obj_list_t* parse_filter(const char *str,
if (m>0)
{ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "extra parameter in FLET <%s>\n",str);
+ error_msg("extra parameter in FLET <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -371,7 +369,7 @@ obj_list_t* parse_filter(const char *str,
if (m>0)
{ /*nbit does not have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "extra parameter in NBIT <%s>\n",str);
+ error_msg("extra parameter in NBIT <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -386,13 +384,13 @@ obj_list_t* parse_filter(const char *str,
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);
+ error_msg("missing compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
else {
if (obj_list) free(obj_list);
- error_msg(progname, "invalid filter type in <%s>\n",str);
+ error_msg("invalid filter type in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -415,7 +413,7 @@ obj_list_t* parse_filter(const char *str,
if (filt->cd_values[0]>9 )
{
if (obj_list) free(obj_list);
- error_msg(progname, "invalid compression parameter in <%s>\n",str);
+ error_msg("invalid compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
break;
@@ -430,19 +428,19 @@ obj_list_t* parse_filter(const char *str,
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);
+ error_msg("pixels_per_block is not even in <%s>\n",str);
exit(EXIT_FAILURE);
}
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);
+ error_msg("pixels_per_block is too large in <%s>\n",str);
exit(EXIT_FAILURE);
}
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");
+ error_msg("szip mask must be 'NN' or 'EC' \n");
exit(EXIT_FAILURE);
}
break;
@@ -519,7 +517,7 @@ obj_list_t* parse_layout(const char *str,
obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
{
- error_msg(progname, "could not allocate object list\n");
+ error_msg("could not allocate object list\n");
return NULL;
}
*n_objs=n;
@@ -543,7 +541,7 @@ obj_list_t* parse_layout(const char *str,
if (end_obj+1==(int)len)
{
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, no characters after : in <%s>\n",str);
+ error_msg("in parse layout, no characters after : in <%s>\n",str);
exit(EXIT_FAILURE);
}
@@ -560,7 +558,7 @@ obj_list_t* parse_layout(const char *str,
else if (strcmp(slayout,"CHUNK")==0)
pack->layout=H5D_CHUNKED;
else {
- error_msg(progname, "in parse layout, not a valid layout in <%s>\n",str);
+ error_msg("in parse layout, not a valid layout in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -584,7 +582,7 @@ obj_list_t* parse_layout(const char *str,
if (j>(int)len)
{
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> Chunk dimensions missing\n",str);
+ error_msg("in parse layout, <%s> Chunk dimensions missing\n",str);
exit(EXIT_FAILURE);
}
@@ -598,7 +596,7 @@ obj_list_t* parse_layout(const char *str,
&& c!='N' && c!='O' && c!='N' && c!='E'
){
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> Not a valid character in <%s>\n",
+ error_msg("in parse layout, <%s> Not a valid character in <%s>\n",
sdim,str);
exit(EXIT_FAILURE);
}
@@ -611,7 +609,7 @@ obj_list_t* parse_layout(const char *str,
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0) {
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
exit(EXIT_FAILURE);
}
@@ -629,7 +627,7 @@ obj_list_t* parse_layout(const char *str,
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0){
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
exit(EXIT_FAILURE);
}
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index ac4570b..34c5dd6 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -14,9 +14,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
+#include "h5test.h"
#include "h5tools_utils.h"
-extern char *progname;
static int verify_layout(hid_t pid, pack_info_t *obj);
static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
@@ -211,26 +211,26 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* Get file creation property list for input file */
if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto error;
}
/* Get file space management info for input file */
if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) {
- error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ error_msg("failed to retrieve file space strategy & threshold\n");
goto error;
}
/* Output file is already opened */
/* Get file creation property list for output file */
if((fcpl_out = H5Fget_create_plist(fidout)) < 0) {
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto error;
}
/* Get file space management info for output file */
if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) {
- error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ error_msg("failed to retrieve file space strategy & threshold\n");
goto error;
}
@@ -243,11 +243,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* as what is set via the strategy option
*/
if(!options->fs_strategy && out_strat != in_strat) {
- error_msg(progname, "file space strategy not set as unexpected\n");
+ error_msg("file space strategy not set as unexpected\n");
goto error;
} else if(options->fs_strategy && out_strat!= options->fs_strategy) {
- error_msg(progname, "file space strategy not set as unexpectec\n");
+ error_msg("file space strategy not set as unexpectec\n");
goto error;
}
@@ -260,11 +260,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* as what is set via the threshold option.
*/
if(!options->fs_threshold && out_thresh != in_thresh) {
- error_msg(progname, "free space threshold not set as unexpected\n");
+ error_msg("free space threshold not set as unexpected\n");
goto error;
} else if(options->fs_threshold && out_thresh != options->fs_threshold) {
- error_msg(progname, "free space threshold not set as unexpectec\n");
+ error_msg("free space threshold not set as unexpectec\n");
goto error;
}
@@ -396,12 +396,12 @@ int h5repack_cmp_pl(const char *fname1,
/* Open the files */
if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
- error_msg(progname, "<%s>: %s\n", fname1, H5FOPENERROR );
+ error_msg("<%s>: %s\n", fname1, H5FOPENERROR );
return -1;
}
if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
- error_msg(progname, "<%s>: %s\n", fname2, H5FOPENERROR );
+ error_msg("<%s>: %s\n", fname2, H5FOPENERROR );
H5Fclose(fid1);
return -1;
}
@@ -450,7 +450,7 @@ int h5repack_cmp_pl(const char *fname1,
if ( crt_order_flag1 != crt_order_flag2 )
{
- error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name);
+ error_msg("property lists for <%s> are different\n",trav->objs[i].name);
goto error;
}
@@ -478,7 +478,7 @@ int h5repack_cmp_pl(const char *fname1,
if(ret == 0)
{
- error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name);
+ error_msg("property lists for <%s> are different\n",trav->objs[i].name);
goto error;
}
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 74c901f..a9efe25 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -91,9 +91,8 @@ const char *H5REPACK_FILENAMES[] = {
#define H5REPACK_EXTFILE "h5repack_ext.bin"
-
-const char *progname = "h5repacktst";
-int d_status = EXIT_SUCCESS;
+/* Name of tool */
+#define PROGRAMNAME "h5repacktst"
#define DIM1 40
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index b16e0d4..332fcc5 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -16,8 +16,12 @@
#include <stdio.h>
#include "h5repack.h"
#include "h5tools.h"
+#include "h5test.h"
+/* Name of tool */
+#define PROGRAMNAME "h5repack_detect_szip"
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -40,6 +44,9 @@
int main(void)
{
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
#ifdef H5_HAVE_FILTER_SZIP
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
printf("yes\n");