diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-05-11 17:49:41 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-05-11 17:49:41 (GMT) |
commit | 05d75af8b88cc13232eda2b1660c1bb9ae0bb831 (patch) | |
tree | 6f103b56a01c45a3b98bd914f4cccb996bbc931e /tools/h5repack | |
parent | 9e595dec197d2812b13c4b86cf3389549c54fbb5 (diff) | |
download | hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.zip hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.tar.gz hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.tar.bz2 |
[svn-r18757] Enable tools lib to be built as a dll on windows. Added two get/set functions for progname and d_status.
Also add windows import/export declarations to functions.
Updated windows - H5pubconf.h for packed bits function
Tested:
Windows, linux
Diffstat (limited to 'tools/h5repack')
-rw-r--r-- | tools/h5repack/h5repack.c | 30 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 49 | ||||
-rw-r--r-- | tools/h5repack/h5repack_main.c | 39 | ||||
-rw-r--r-- | tools/h5repack/h5repack_opttable.c | 12 | ||||
-rw-r--r-- | tools/h5repack/h5repack_parse.c | 52 | ||||
-rw-r--r-- | tools/h5repack/h5repack_verify.c | 9 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 5 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_detect_szip.c | 5 |
8 files changed, 99 insertions, 102 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 0256650..ddca593 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 @@ -157,7 +153,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(h5tools_getprogname(), "maximum number of filters exceeded for <%s>\n", str); free(obj_list); return -1; } @@ -195,7 +191,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(h5tools_getprogname(), "invalid layout input: 'all' option \ is present with other objects <%s>\n",str); return -1; } @@ -614,7 +610,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(h5tools_getprogname(), "invalid layout\n"); return -1; default: strcpy(slayout,"invalid layout\n"); @@ -655,7 +651,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(h5tools_getprogname(), "invalid chunking input: 'all' option\ is present with other objects\n"); return -1; } @@ -717,7 +713,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(h5tools_getprogname(), "invalid compression input: 'all' option\ is present with other objects\n"); return -1; } @@ -729,24 +725,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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "invalid shared message size\n"); return -1; } } @@ -768,7 +764,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(h5tools_getprogname(), "file name missing for user block\n", options->ublock_filename); return -1; } @@ -781,7 +777,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(h5tools_getprogname(), "alignment for H5Pset_alignment missing\n"); return -1; } @@ -853,7 +849,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(h5tools_getprogname(), "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose?"\n":""),name,fname); goto out; } @@ -975,7 +971,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(h5tools_getprogname(), "input error in filter type\n"); exit(EXIT_FAILURE); } } diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 4376390..b4c191c 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(h5tools_getprogname(), "<%s>: %s\n", fnamein, H5FOPENERROR ); goto out; } @@ -100,19 +99,19 @@ 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(h5tools_getprogname(), "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(h5tools_getprogname(), "failed to retrieve userblock size\n"); goto out; } if(H5Pclose(fcpl_in) < 0) { - error_msg(progname, "failed to close property list\n"); + error_msg(h5tools_getprogname(), "failed to close property list\n"); goto out; } } @@ -123,7 +122,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(h5tools_getprogname(), "fail to create a file creation property list\n"); goto out; } @@ -131,7 +130,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(h5tools_getprogname(), "failed to set non-default userblock size\n"); goto out; } } @@ -144,7 +143,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(h5tools_getprogname(), "fail to adjust group creation parameters for root group\n"); goto out; } @@ -186,7 +185,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(h5tools_getprogname(), "fail to set the number of shared object header message indexes\n"); goto out; } @@ -194,7 +193,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(h5tools_getprogname(), "fail to configure the specified shared object header message index\n"); goto out; } /* end if */ } /* end for */ @@ -203,13 +202,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(h5tools_getprogname(), "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(h5tools_getprogname(), "Could not set property for using latest version of the format\n"); goto out; } /* end if */ } /* end if */ @@ -236,7 +235,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(h5tools_getprogname(), "failed to set userblock size\n"); goto out; } @@ -248,14 +247,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(h5tools_getprogname(), "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(h5tools_getprogname(), "failed to set userblock size\n"); goto out; } @@ -280,7 +279,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(h5tools_getprogname(), "failed to set alignment\n"); goto out; } @@ -292,13 +291,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(h5tools_getprogname(), "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(h5tools_getprogname(), "failed to set alignment\n"); goto out; } @@ -319,7 +318,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(h5tools_getprogname(), "<%s>: Could not create file\n", fnameout ); goto out; } @@ -332,7 +331,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(h5tools_getprogname(), "Could not copy user block. Exiting...\n"); goto out; } @@ -356,7 +355,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(h5tools_getprogname(), "<%s>: Could not copy data to: %s\n", fnamein, fnameout); goto out; } /* end if */ @@ -398,7 +397,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(h5tools_getprogname(), "Could not copy user block. Exiting...\n"); goto out; } @@ -1362,19 +1361,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(h5tools_getprogname(), "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(h5tools_getprogname(), "failed to retrieve userblock size\n"); goto done; } if(H5Pclose(fcpl) < 0) { - error_msg(progname, "failed to close property list\n"); + error_msg(h5tools_getprogname(), "failed to close property list\n"); goto done; } diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index f52aa5a..aaabeac 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; @@ -105,6 +105,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); @@ -121,8 +124,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(h5tools_getprogname(), "file names cannot be the same\n"); + usage(h5tools_getprogname()); exit(EXIT_FAILURE); } @@ -130,8 +133,8 @@ int main(int argc, const char **argv) else { - error_msg(progname, "file names missing\n"); - usage(progname); + error_msg(h5tools_getprogname(), "file names missing\n"); + usage(h5tools_getprogname()); exit(EXIT_FAILURE); } } @@ -304,10 +307,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; @@ -317,7 +320,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(h5tools_getprogname(), "in parsing filter\n"); exit(EXIT_FAILURE); } break; @@ -326,7 +329,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(h5tools_getprogname(), "in parsing layout\n"); exit(EXIT_FAILURE); } break; @@ -337,7 +340,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(h5tools_getprogname(), "invalid minimum compress size <%s>\n", opt_arg ); exit(EXIT_FAILURE); } break; @@ -430,7 +433,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(h5tools_getprogname(), "invalid alignment size\n", opt_arg ); exit(EXIT_FAILURE); } break; @@ -445,8 +448,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(h5tools_getprogname(), "missing file names\n"); + usage(h5tools_getprogname()); exit(EXIT_FAILURE); } } @@ -489,7 +492,7 @@ void read_info(const char *filename, if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { - error_msg(progname, "cannot open options file %s\n", filename); + error_msg(h5tools_getprogname(), "cannot open options file %s\n", filename); exit(EXIT_FAILURE); } @@ -526,7 +529,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(h5tools_getprogname(), "could not add compression option\n"); exit(EXIT_FAILURE); } } @@ -556,7 +559,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(h5tools_getprogname(), "could not add chunck option\n"); exit(EXIT_FAILURE); } } @@ -565,7 +568,7 @@ void read_info(const char *filename, *------------------------------------------------------------------------- */ else { - error_msg(progname, "bad file format for %s", filename); + error_msg(h5tools_getprogname(), "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..d1cb97a 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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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..b5753e6 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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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(h5tools_getprogname(), "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 e64e85a..90a3671 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -17,7 +17,6 @@ #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); @@ -313,12 +312,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(h5tools_getprogname(), "<%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(h5tools_getprogname(), "<%s>: %s\n", fname2, H5FOPENERROR ); H5Fclose(fid1); return -1; } @@ -367,7 +366,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(h5tools_getprogname(), "property lists for <%s> are different\n",trav->objs[i].name); goto error; } @@ -395,7 +394,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(h5tools_getprogname(), "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 d77ba5f..57fb1ce 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -88,9 +88,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 906996a..332fcc5 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -19,6 +19,8 @@ #include "h5test.h" +/* Name of tool */ +#define PROGRAMNAME "h5repack_detect_szip" /*------------------------------------------------------------------------- * Function: main @@ -42,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"); |