diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-15 19:25:27 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-15 19:25:27 (GMT) |
commit | a6cbc806638a682f0685c086feb87c32a8119ef2 (patch) | |
tree | 48537c01f5d7d637f624a03d01c5b45b5c6d7a8e /tools/h5repack/h5repack_copy.c | |
parent | 89c9bfc05b97068c7b1649e85f9cfeff87be7441 (diff) | |
download | hdf5-a6cbc806638a682f0685c086feb87c32a8119ef2.zip hdf5-a6cbc806638a682f0685c086feb87c32a8119ef2.tar.gz hdf5-a6cbc806638a682f0685c086feb87c32a8119ef2.tar.bz2 |
[svn-r8882] Purpose:
bug fix, new feature
Description:
fixed bug in the parse function:
cases where we have an already inserted name but there is a new name also
example:
-f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
dset1 is already inserted, but dset2 must also be (it was not)
added a CHECK_SZIP symbol to enable/disable checking of library related szip parameters
added the print of the filter name in verbose mode (confirms visually that the filter was applied )
Solution:
Platforms tested:
linux
solaris
AIX
Misc. update:
Diffstat (limited to 'tools/h5repack/h5repack_copy.c')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 84 |
1 files changed, 62 insertions, 22 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index e352b97..870f3c7 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -26,7 +26,7 @@ * * Return: 0, ok, -1 no * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: October, 23, 2003 * @@ -45,27 +45,18 @@ int copy_objects(const char* fnamein, * open the files *------------------------------------------------------------------------- */ - - /* disable error reporting */ - H5E_BEGIN_TRY { - - /* Open the files */ if ((fidin=H5Fopen(fnamein,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ){ printf("h5repack: <%s>: %s\n", fnamein, H5FOPENERROR ); - exit(1); + goto out; } if ((fidout=H5Fcreate(fnameout,H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0 ){ printf("h5repack: <%s>: Could not create file\n", fnameout ); - exit(1); + goto out; } - /* enable error reporting */ - } H5E_END_TRY; - if (options->verbose) printf("Making file <%s>...\n",fnameout); - /* init table */ trav_table_init(&travt); @@ -111,15 +102,56 @@ int copy_objects(const char* fnamein, out: H5E_BEGIN_TRY { - H5Fclose(fidin); - H5Fclose(fidout); - trav_table_free(travt); + H5Fclose(fidin); + H5Fclose(fidout); } H5E_END_TRY; + if (travt) + trav_table_free(travt); return -1; } +/*------------------------------------------------------------------------- + * Function: print_obj + * + * Purpose: print name and filters of an object + * + *------------------------------------------------------------------------- + */ + + +void print_obj(pack_info_t *obj, char *name) +{ + char str[26]; /*5x5+1*/ + int i; + + strcpy(str,"\0"); + + for ( i=0; i<obj->nfilters; i++) + { + switch (obj->filter[i].filtn) + { + default: + break; + case H5Z_FILTER_DEFLATE: + strcat(str,"GZIP "); + break; + case H5Z_FILTER_SZIP: + strcat(str,"SZIP "); + break; + case H5Z_FILTER_SHUFFLE: + strcat(str,"SHUF "); + break; + case H5Z_FILTER_FLETCHER32: + strcat(str,"FLET "); + break; + } /* switch */ + }/*i*/ + + printf(" %-10s %s %s\n", "dataset",str,name ); + +} /*------------------------------------------------------------------------- @@ -129,7 +161,7 @@ out: * * Return: 0, ok, -1 no * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: October, 23, 2003 * @@ -162,6 +194,7 @@ int do_copy_objects(hid_t fidin, hsize_t dsize_out; /* output dataset size after filter */ #endif /* LATER */ int i, j; + int wrote=0; /*------------------------------------------------------------------------- * copy the suppplied object list @@ -208,9 +241,6 @@ int do_copy_objects(hid_t fidin, *------------------------------------------------------------------------- */ case H5G_DATASET: - if (options->verbose) - printf(" %-10s %s\n", "dataset",travt->objs[i].name ); - if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) goto error; if ((space_id=H5Dget_space(dset_in))<0) @@ -311,12 +341,11 @@ int do_copy_objects(hid_t fidin, */ if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) goto error; - if (dsize_in && nelmts) { if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto error; + wrote=1; } - /*------------------------------------------------------------------------- * copy attrs *------------------------------------------------------------------------- @@ -339,6 +368,11 @@ int do_copy_objects(hid_t fidin, if (buf) free(buf); + + if (options->verbose && wrote) + print_obj(&obj,travt->objs[i].name ); + + }/*H5T_STD_REF_OBJ*/ }/*can_read*/ @@ -488,7 +522,7 @@ error: * * Return: 0, ok, -1 no * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: October, 28, 2003 * @@ -565,6 +599,8 @@ int copy_attr(hid_t loc_in, */ if ( ! H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { + + /*------------------------------------------------------------------------- * read to memory *------------------------------------------------------------------------- @@ -592,6 +628,7 @@ int copy_attr(hid_t loc_in, if (H5Aclose(attr_out)<0) goto error; + if (buf) free(buf); @@ -629,3 +666,6 @@ error: return -1; } + + + |