summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-09-18 16:06:28 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-09-18 16:06:28 (GMT)
commitfffa1adc9aa4f0e2b099f130750346b4526c15d1 (patch)
tree6ca70ab4c60b13361d6932307b2e20ac721f58b7 /tools
parentc3b40626a0e49bc8169d0dd0cbb956a8297f5999 (diff)
downloadhdf5-fffa1adc9aa4f0e2b099f130750346b4526c15d1.zip
hdf5-fffa1adc9aa4f0e2b099f130750346b4526c15d1.tar.gz
hdf5-fffa1adc9aa4f0e2b099f130750346b4526c15d1.tar.bz2
[svn-r15652] Cleaned compiler warnings
Bug fix: do not print print compression ratio when the requested filter is NONE Tested: windows, linux
Diffstat (limited to 'tools')
-rw-r--r--tools/h5repack/h5repack.c22
-rw-r--r--tools/h5repack/h5repack_copy.c66
-rw-r--r--tools/h5repack/h5repack_opttable.c2
3 files changed, 64 insertions, 26 deletions
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 8408778..2d3ff65 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -101,9 +101,9 @@ int h5repack_init (pack_opt_t *options,
for ( n = 0; n < H5_REPACK_MAX_NFILTERS; n++)
{
options->filter_g[n].filtn = -1;
- options->filter_g[n].cd_nelmts = -1;
+ options->filter_g[n].cd_nelmts = 0;
for ( k = 0; k < CD_VALUES; k++)
- options->filter_g[n].cd_values[k] = -1;
+ options->filter_g[n].cd_values[k] = 0;
}
return (options_table_init(&(options->op_tbl)));
@@ -520,18 +520,18 @@ static int check_objects(const char* fname,
/* chunk size must be smaller than pixels per block */
case H5Z_FILTER_SZIP:
{
- int j;
- int csize = 1;
- int ppb = options->op_tbl->objs[i].filter->cd_values[0];
- hsize_t dims[H5S_MAX_RANK];
- int rank;
- hid_t did;
- hid_t sid;
+ int j;
+ hsize_t csize = 1;
+ unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0];
+ hsize_t dims[H5S_MAX_RANK];
+ int rank;
+ hid_t did;
+ hid_t sid;
if(options->op_tbl->objs[i].chunk.rank > 0) {
rank = options->op_tbl->objs[i].chunk.rank;
for(j = 0; j < rank; j++)
- csize *= (int)options->op_tbl->objs[i].chunk.chunk_lengths[j];
+ csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j];
}
else {
if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
@@ -544,7 +544,7 @@ static int check_objects(const char* fname,
if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
goto out;
for(j = 0; j < rank; j++)
- csize *= (int)dims[j];
+ csize *= dims[j];
if(H5Sclose(sid) < 0)
goto out;
if(H5Dclose(did) < 0)
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 999dce4..a49b2f7 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -41,7 +41,9 @@ static void print_dataset_info(hid_t dcpl_id,char *objname,double per, int pr);
static int do_copy_objects(hid_t fidin,hid_t fidout,trav_table_t *travt,pack_opt_t *options);
static int copy_attr(hid_t loc_in,hid_t loc_out,pack_opt_t *options);
static int copy_user_block(const char *infile, const char *outfile, hsize_t size);
+#if defined (H5REPACK_DEBUG)
static void print_user_block(const char *filename, hid_t fid);
+#endif
/*-------------------------------------------------------------------------
* Function: copy_objects
@@ -491,7 +493,9 @@ int do_copy_objects(hid_t fidin,
void *buf=NULL; /* buffer for raw data */
void *sm_buf=NULL; /* buffer for raw data */
int has_filter; /* current object has a filter */
+ int req_filter; /* there was a request for a filter */
unsigned i;
+ unsigned u;
int is_ref=0;
/*-------------------------------------------------------------------------
@@ -499,16 +503,19 @@ int do_copy_objects(hid_t fidin,
*-------------------------------------------------------------------------
*/
- if (options->verbose) {
+ if (options->verbose)
+ {
printf("-----------------------------------------\n");
printf(" Type Filter (Compression) Name\n");
printf("-----------------------------------------\n");
}
- for ( i = 0; i < travt->nobjs; i++) {
+ for ( i = 0; i < travt->nobjs; i++)
+ {
buf = NULL;
- switch ( travt->objs[i].type ) {
+ switch ( travt->objs[i].type )
+ {
/*-------------------------------------------------------------------------
* H5TRAV_TYPE_GROUP
*-------------------------------------------------------------------------
@@ -522,11 +529,13 @@ int do_copy_objects(hid_t fidin,
* and copy its attributes using that ID
*-------------------------------------------------------------------------
*/
- if(HDstrcmp(travt->objs[i].name, "/") == 0) {
+ if(HDstrcmp(travt->objs[i].name, "/") == 0)
+ {
if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
goto error;
}
- else if (options->grp_compact>0 || options->grp_indexed>0) {
+ else if (options->grp_compact>0 || options->grp_indexed>0)
+ {
/* Set up group creation property list */
if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
goto error;
@@ -537,7 +546,8 @@ int do_copy_objects(hid_t fidin,
if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto error;
}
- else {
+ else
+ {
if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
}
@@ -570,6 +580,24 @@ int do_copy_objects(hid_t fidin,
case H5TRAV_TYPE_DATASET:
has_filter = 0;
+ req_filter = 0;
+
+ /* check if filters were requested */
+ for( u = 0; u < options->op_tbl->nelems; u++)
+ {
+ int k;
+
+ for( k = 0; k < options->op_tbl->objs[u].nfilters; k++)
+ {
+ if ( options->op_tbl->objs[u].filter->filtn > 0 )
+ {
+
+ req_filter = 1;
+
+ }
+
+ }
+ }
/* early detection of references */
if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
@@ -590,10 +618,14 @@ int do_copy_objects(hid_t fidin,
* otherwise we do a copy using H5Ocopy
*-------------------------------------------------------------------------
*/
- if(options->op_tbl->nelems || options->all_filter == 1
- || options->all_layout == 1 || is_ref) {
- int j;
-
+ if ( options->op_tbl->nelems ||
+ options->all_filter == 1 ||
+ options->all_layout == 1 ||
+ is_ref)
+ {
+
+ int j;
+
if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
if((f_space_id = H5Dget_space(dset_in)) < 0)
@@ -610,8 +642,10 @@ int do_copy_objects(hid_t fidin,
if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
goto error;
nelmts = 1;
- for(j = 0; j < rank; j++)
+ for ( j = 0; j < rank; j++)
+ {
nelmts *= dims[j];
+ }
if(options->use_native == 1)
wtype_id = h5tools_get_native_type(ftype_id);
@@ -649,7 +683,8 @@ int do_copy_objects(hid_t fidin,
apply_s=0;
/* apply the filter */
- if (apply_s) {
+ if (apply_s)
+ {
if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options,&has_filter) < 0)
goto error;
}
@@ -800,8 +835,8 @@ int do_copy_objects(hid_t fidin,
{
double ratio=0;
- /* only print the compression ration if there was a filter */
- if (apply_s && apply_f && has_filter)
+ /* only print the compression ration if there was a filter request */
+ if (apply_s && apply_f && req_filter)
{
hssize_t a, b;
@@ -1390,6 +1425,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+#if defined (H5REPACK_DEBUG)
static
void print_user_block(const char *filename, hid_t fid)
{
@@ -1463,3 +1499,5 @@ done:
return;
}
+#endif
+
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index bdcae02..8572837 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -39,7 +39,7 @@ void init_packobject(pack_info_t *obj)
{
obj->filter[j].filtn = -1;
for ( k=0; k<CD_VALUES; k++)
- obj->filter[j].cd_values[k] = -1;
+ obj->filter[j].cd_values[k] = 0;
}
obj->chunk.rank = -1;
obj->refobj_id = -1;