diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-09-17 16:04:37 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-09-17 16:04:37 (GMT) |
commit | c3113b0e3ca9b7c19a4695b8d905f197051911a4 (patch) | |
tree | 80dbaa39978324fe21f6d8320811bd244c3ab1c8 /tools/h5repack/h5repack_copy.c | |
parent | 3f043d5cca98bf90146fc81fd7e9d194a2407e9b (diff) | |
download | hdf5-c3113b0e3ca9b7c19a4695b8d905f197051911a4.zip hdf5-c3113b0e3ca9b7c19a4695b8d905f197051911a4.tar.gz hdf5-c3113b0e3ca9b7c19a4695b8d905f197051911a4.tar.bz2 |
[svn-r15642]
Add a default user block size of 1024 when none is given
add a failure condition of writing user block
Tested: windows, linux
Diffstat (limited to 'tools/h5repack/h5repack_copy.c')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index b0d475f..b9bfce1 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -294,7 +294,7 @@ int copy_objects(const char* fnamein, { error_msg(progname, "<%s>: Could not create file\n", fnameout ); goto out; - } /* end if */ + } /*------------------------------------------------------------------------- @@ -303,7 +303,12 @@ int copy_objects(const char* fnamein, */ if ( options->ublock_size > 0 ) { - copy_user_block( options->ublock_filename, fnameout, options->ublock_size); + if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 ) + { + error_msg(progname, "Could not copy user block. Exiting...\n"); + goto out; + + } } @@ -329,14 +334,11 @@ int copy_objects(const char* fnamein, * and create hard links *------------------------------------------------------------------------- */ - if(do_copy_refobjs(fidin, fidout, travt, options) < 0) { + if ( do_copy_refobjs(fidin, fidout, travt, options) < 0 ) + { printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); goto out; - } /* end if */ - - /* free table */ - trav_table_free(travt); - + } /*------------------------------------------------------------------------- * close @@ -351,10 +353,25 @@ int copy_objects(const char* fnamein, H5Fclose(fidin); H5Fclose(fidout); + + /* free table */ + trav_table_free(travt); + travt = NULL; + + /*------------------------------------------------------------------------- + * write only the input file user block if there is no user block file input + *------------------------------------------------------------------------- + */ - /* 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); + if( ub_size > 0 && options->ublock_size == 0 ) + { + if ( copy_user_block(fnamein, fnameout, ub_size) < 0 ) + { + error_msg(progname, "Could not copy user block. Exiting...\n"); + goto out; + + } + } return 0; |