summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-09-18 18:08:04 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-09-18 18:08:04 (GMT)
commit6eb624a09d282d0f1346afe769f0fb2654b4de58 (patch)
treed2c7d29e609b1f31ef71390a0c61da603f8d779e
parentfffa1adc9aa4f0e2b099f130750346b4526c15d1 (diff)
downloadhdf5-6eb624a09d282d0f1346afe769f0fb2654b4de58.zip
hdf5-6eb624a09d282d0f1346afe769f0fb2654b4de58.tar.gz
hdf5-6eb624a09d282d0f1346afe769f0fb2654b4de58.tar.bz2
[svn-r15653] cleaned warnings
tested: windows, linux
-rw-r--r--tools/h5repack/h5repack_main.c68
-rw-r--r--tools/h5repack/h5repack_parse.c16
-rw-r--r--tools/h5repack/h5repack_verify.c12
3 files changed, 22 insertions, 74 deletions
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index dcdce82..1ec8e88 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -22,8 +22,7 @@
static void usage(const char *prog);
-static int parse_number(char *str);
-static void parse_command_line(int argc, const char* argv[], pack_opt_t* options);
+static void parse_command_line(int argc, const char **argv, pack_opt_t* options);
static void read_info(const char *filename,pack_opt_t *options);
@@ -94,10 +93,10 @@ static struct long_options l_opts[] = {
* add options to set alignment (H5Pset_alignment) (switches -t -a)
*-------------------------------------------------------------------------
*/
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
- char *infile = NULL;
- char *outfile = NULL;
+ const char *infile = NULL;
+ const char *outfile = NULL;
pack_opt_t options; /*the global options */
int ret=-1;
int i;
@@ -170,7 +169,7 @@ int main(int argc, char **argv)
else if (strcmp(argv[i], "-m") == 0)
{
- options.min_comp = parse_number(argv[i+1]);
+ options.min_comp = atoi(argv[i+1]);
if ((int)options.min_comp<=0)
{
error_msg(progname, "invalid minimum compress size <%s>\n",argv[i+1]);
@@ -207,7 +206,7 @@ int main(int argc, char **argv)
else if (strcmp(argv[i], "-s") == 0)
{
- char *s = argv[++i];
+ const char *s = argv[++i];
int idx = 0;
int ssize = 0;
char *msgPtr = strchr( s, ':');
@@ -431,7 +430,8 @@ static void usage(const char *prog)
*-------------------------------------------------------------------------
*/
-static void parse_command_line(int argc, const char* argv[], pack_opt_t* options)
+static
+void parse_command_line(int argc, const char **argv, pack_opt_t* options)
{
int opt;
@@ -472,7 +472,7 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options
case 'm':
- options->min_comp = parse_number( opt_arg );
+ options->min_comp = atoi( opt_arg );
if ((int)options->min_comp<=0)
{
error_msg(progname, "invalid minimum compress size <%s>\n", opt_arg );
@@ -555,22 +555,18 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options
case 'b':
- options->ublock_size = atoi( opt_arg );
+ options->ublock_size = atol( opt_arg );
break;
case 't':
- options->threshold = atoi( opt_arg );
- if ( options->threshold < 0 )
- {
- error_msg(progname, "invalid threshold size\n", opt_arg );
- exit(EXIT_FAILURE);
- }
+ options->threshold = atol( opt_arg );
+
break;
case 'a':
- options->alignment = atoi( opt_arg );
+ options->alignment = atol( opt_arg );
if ( options->alignment < 1 )
{
error_msg(progname, "invalid alignment size\n", opt_arg );
@@ -591,47 +587,9 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options
exit(EXIT_FAILURE);
}
-
-
-
}
/*-------------------------------------------------------------------------
- * Function: parse_number
- *
- * Purpose: read a number from command line argument
- *
- * Return: number, -1 for FAIL
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: September, 23, 2003
- *
- *-------------------------------------------------------------------------
- */
-
-
-int parse_number(char *str)
-{
- unsigned i;
- int n;
- char c;
- size_t len=strlen(str);
-
- for ( i=0; i<len; i++)
- {
- c = str[i];
- if (!isdigit(c)){
- return -1;
- }
- }
- str[i]='\0';
- n=atoi(str);
- return n;
-}
-
-
-/*-------------------------------------------------------------------------
* Function: read_info
*
* Purpose: read comp and chunk options from a file
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index f7188bf..d684da8 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -412,7 +412,7 @@ obj_list_t* parse_filter(const char *str,
*/
case H5Z_FILTER_DEFLATE:
- if (filt->cd_values[0]<0 || filt->cd_values[0]>9 )
+ if (filt->cd_values[0]>9 )
{
if (obj_list) free(obj_list);
error_msg(progname, "invalid compression parameter in <%s>\n",str);
@@ -447,19 +447,7 @@ obj_list_t* parse_filter(const char *str,
}
break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- *-------------------------------------------------------------------------
- */
-
- case H5Z_FILTER_SCALEOFFSET:
- if (filt->cd_values[0]<0 )
- {
- if (obj_list) free(obj_list);
- error_msg(progname, "invalid compression parameter in <%s>\n",str);
- exit(1);
- }
- break;
+
};
return obj_list;
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index fed4499..a7454d6 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -19,7 +19,7 @@
extern char *progname;
static int has_layout(hid_t pid, pack_info_t *obj);
-static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *filter);
+static int has_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
/*-------------------------------------------------------------------------
@@ -442,16 +442,18 @@ error:
*-------------------------------------------------------------------------
*/
-static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *filter)
+static
+int has_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
{
- unsigned nfilters_dcpl; /* number of filters in DCPL*/
+ int nfilters_dcpl; /* number of filters in DCPL*/
unsigned filt_flags; /* filter flags */
H5Z_filter_t filtn; /* filter identification number */
unsigned cd_values[20]; /* filter client data values */
size_t cd_nelmts; /* filter client number of values */
char f_name[256]; /* filter name */
size_t size; /* type size */
- unsigned i, j; /* index */
+ int i; /* index */
+ unsigned j; /* index */
/* get information about filters */
if((nfilters_dcpl = H5Pget_nfilters(pid)) < 0)
@@ -475,7 +477,7 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f
for( i = 0; i < nfilters_dcpl; i++)
{
cd_nelmts = NELMTS(cd_values);
- filtn = H5Pget_filter2(pid, i, &filt_flags, &cd_nelmts,
+ filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
/* filter ID */