summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-05-24 18:49:25 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-05-24 18:49:25 (GMT)
commit9b43a9f61441daf31f2fa41ac000672ed90d9c12 (patch)
tree17086b24030b4afcae0b611ecb250986717779ce
parentf318e8a4a0376d0f3c63b18a6e1629e651dcb353 (diff)
downloadhdf5-9b43a9f61441daf31f2fa41ac000672ed90d9c12.zip
hdf5-9b43a9f61441daf31f2fa41ac000672ed90d9c12.tar.gz
hdf5-9b43a9f61441daf31f2fa41ac000672ed90d9c12.tar.bz2
[svn-r13809]
Minor tunings to output verbose messages: when there is not a filter request do not print a message saying the filter was not apllied when the dataset was too small Tested:linux
-rw-r--r--tools/h5repack/h5repack.c24
-rw-r--r--tools/h5repack/h5repack.h7
-rw-r--r--tools/h5repack/h5repack_copy.c18
-rw-r--r--tools/h5repack/h5repack_filters.c13
-rw-r--r--tools/h5repack/h5repack_main.c2
5 files changed, 50 insertions, 14 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 9e7da9e..c10c608 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -258,7 +258,7 @@ static int check_options(pack_opt_t *options)
* objects to layout
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose && have_request(options) /* only print if requested */)
{
printf("Objects to modify layout are...\n");
if (options->all_layout==1) {
@@ -320,7 +320,7 @@ static int check_options(pack_opt_t *options)
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose && have_request(options) /* only print if requested */)
{
printf("Objects to apply filter are...\n");
if (options->all_filter==1)
@@ -376,3 +376,23 @@ static int check_options(pack_opt_t *options)
+/*-------------------------------------------------------------------------
+ * Function: have_request
+ *
+ * Purpose: check if a filter or layout was requested
+ *
+ * Return: 1 yes, 0 no
+ *
+ * Date: May, 24, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+int have_request(pack_opt_t *options)
+{
+
+ if (options->all_filter || options->all_layout || options->op_tbl->nelems)
+ return 1;
+
+ return 0;
+
+} \ No newline at end of file
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index c3772cf..9ecb839 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -152,6 +152,8 @@ int do_copy_refobjs(hid_t fidin,
void init_packobject(pack_info_t *obj);
int print_filters(hid_t dcpl_id);
+int have_request(pack_opt_t *options);
+
@@ -163,8 +165,9 @@ int print_filters(hid_t dcpl_id);
int apply_filters(const char* name, /* object name from traverse list */
int rank, /* rank of dataset */
hsize_t *dims, /* dimensions of dataset */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options); /* repack options */
+ hid_t dcpl_id, /* (IN,OUT) dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int *has_filter); /* (OUT) object NAME has a filter */
int has_filter(hid_t dcpl_id,
H5Z_filter_t filtnin);
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 6512444..562af8b 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -228,6 +228,7 @@ int do_copy_objects(hid_t fidin,
double per; /* percent utilization of storage */
void *buf=NULL; /* buffer for raw data */
void *sm_buf=NULL; /* buffer for raw data */
+ int has_filter; /* current object has a filter */
unsigned i;
int j;
@@ -336,6 +337,9 @@ int do_copy_objects(hid_t fidin,
}
else /* H5T_REFERENCE */
{
+
+ has_filter = 0;
+
/* get the storage size of the input dataset */
dsize_in=H5Dget_storage_size(dset_in);
@@ -346,7 +350,7 @@ int do_copy_objects(hid_t fidin,
/* apply the filter */
if (apply_s)
{
- if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options)<0)
+ if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options,&has_filter)<0)
goto error;
}
@@ -501,17 +505,21 @@ int do_copy_objects(hid_t fidin,
}
else
print_dataset_info(dcpl_id,travt->objs[i].name,0.0);
- }
-
- if (apply_s==0 && options->verbose)
+
+ /* print a message that the filter was not applied
+ (in case there was a filter)
+ */
+ if ( has_filter && apply_s == 0 )
printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n",
travt->objs[i].name,
(int)options->threshold);
- if (apply_f==0 && options->verbose)
+ if ( has_filter && apply_f == 0 )
printf(" <warning: could not apply the filter to %s>\n",
travt->objs[i].name);
+ } /* verbose */
+
/*-------------------------------------------------------------------------
* copy attrs
*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index e102cf6..0f5bdd8 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -28,7 +28,7 @@
static
int aux_find_obj(const char* name, /* object name from traverse list */
pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
char *pdest;
int result;
@@ -190,14 +190,17 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
int apply_filters(const char* name, /* object name from traverse list */
int rank, /* rank of dataset */
hsize_t *dims, /* dimensions of dataset */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options) /* repack options */
+ hid_t dcpl_id, /* (IN,OUT) dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int *has_filter) /* (OUT) object NAME has a filter */
{
int nfilters; /* number of filters in DCPL */
hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
int i;
pack_info_t obj;
+
+ *has_filter = 0;
if (rank==0) /* scalar dataset, do not apply */
return 0;
@@ -225,7 +228,9 @@ int apply_filters(const char* name, /* object name from traverse list */
* 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;
}
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 11ca9e0..6da0c55 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -184,7 +184,7 @@ void read_info(const char *filename,
if ((fp = fopen(data_file, "r")) == (FILE *)NULL) {
- error_msg(progname, "cannot open options file %s", filename);
+ error_msg(progname, "cannot open options file %s\n", filename);
exit(1);
}