mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
[svn-r13810]
Minor tunings to output verbose messages: 1)when there is not a filter request do not print a message saying the filter was not apllied when the dataset was too small 2) avoid printing the message that has a list of objects to modify when there is none Tested:linux
This commit is contained in:
parent
fa133cfb95
commit
bd2c3b52a8
@ -256,7 +256,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) {
|
||||
@ -318,7 +318,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)
|
||||
@ -407,7 +407,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);
|
||||
}
|
||||
|
||||
@ -493,3 +493,23 @@ void read_info(const char *filename,
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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;
|
||||
|
||||
}
|
@ -153,6 +153,8 @@ int do_copy_refobjs(hid_t fidin,
|
||||
void read_info(const char *filename,pack_opt_t *options);
|
||||
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);
|
||||
|
@ -231,6 +231,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 is_ref=0;
|
||||
|
||||
@ -287,6 +288,8 @@ int do_copy_objects(hid_t fidin,
|
||||
*/
|
||||
case H5G_DATASET:
|
||||
|
||||
has_filter = 0;
|
||||
|
||||
/* early detection of references */
|
||||
if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
|
||||
goto error;
|
||||
@ -376,7 +379,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;
|
||||
}
|
||||
|
||||
@ -529,16 +532,20 @@ 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)
|
||||
printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n",
|
||||
travt->objs[i].name,
|
||||
(int)options->threshold);
|
||||
/* 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)
|
||||
printf(" <warning: could not apply the filter to %s>\n",
|
||||
travt->objs[i].name);
|
||||
if ( has_filter && apply_f == 0 )
|
||||
printf(" <warning: could not apply the filter to %s>\n",
|
||||
travt->objs[i].name);
|
||||
|
||||
} /* verbose */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* copy attrs
|
||||
|
@ -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;
|
||||
@ -187,17 +187,23 @@ 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 +231,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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user