From 0c8cee593ff5907958fbe89de8a3bf6d1fe5b039 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 25 Aug 2008 10:57:14 -0500 Subject: [svn-r15526] userblock options only write the user block of a pre-existing file with user block in case there is no input user block file tested: windows, linux --- tools/h5repack/h5repack.c | 6 +++--- tools/h5repack/h5repack_copy.c | 9 +++++---- tools/h5repack/h5repack_main.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 3809377..73f78f6 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -410,9 +410,9 @@ static int check_options(pack_opt_t *options) } - /*------------------------------------------------------------------------- - * verify new user userblock options - *------------------------------------------------------------------------- + /*-------------------------------------------------------------------------------- + * verify new user userblock options; both file name and block size must be present + *--------------------------------------------------------------------------------- */ if ( options->ublock_filename != NULL && options->ublock_size == 0 ) { diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 3bff946..766da44 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -23,7 +23,7 @@ extern char *progname; -#if 0 +#if 1 #define H5REPACK_DEBUG #endif @@ -203,7 +203,7 @@ int copy_objects(const char* fnamein, *------------------------------------------------------------------------- */ - if ( options->ublock_size > 0 && options->ublock_filename != NULL ) + if ( options->ublock_size > 0 ) { /* either use the FCPL already created or create a new one */ if(fcpl != H5P_DEFAULT) @@ -261,7 +261,7 @@ int copy_objects(const char* fnamein, * write a new user block if requested *------------------------------------------------------------------------- */ - if ( options->ublock_size > 0 && options->ublock_filename != NULL ) + if ( options->ublock_size > 0 ) { copy_user_block( options->ublock_filename, fnameout, options->ublock_size); } @@ -312,7 +312,8 @@ int copy_objects(const char* fnamein, H5Fclose(fidin); H5Fclose(fidout); - if(ub_size > 0) + /* write only the input file user block if there is no user block file input */ + if(ub_size > 0 && options->ublock_size == 0) copy_user_block(fnamein, fnameout, ub_size); return 0; diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index db0a87b..c949732 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -87,7 +87,7 @@ static struct long_options l_opts[] = { * PVN, May 16, 2008 * added backward compatibility for -i infile -o outfile * PVN, August 20, 2008 - * add a user block to file if requested (new switches -u -b) + * add a user block to repacked file (switches -u -b) *------------------------------------------------------------------------- */ int main(int argc, char **argv) -- cgit v0.12