summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_copy.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-04-06 02:57:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-04-06 02:57:06 (GMT)
commitd5a62239587f7cc5de301fa5c6b0919807689818 (patch)
tree40a36d60dd8ac2d10a45886869cc53d3fdc9181e /tools/h5repack/h5repack_copy.c
parentebf3d99b955c705217227fb7f8ae4405e941399a (diff)
downloadhdf5-d5a62239587f7cc5de301fa5c6b0919807689818.zip
hdf5-d5a62239587f7cc5de301fa5c6b0919807689818.tar.gz
hdf5-d5a62239587f7cc5de301fa5c6b0919807689818.tar.bz2
[svn-r22254] Description:
Bring r22085:22251 from trunk to revise_chunks branch. Also tackle some testing issues in test/objcopy.c test and clean up some warnings. Tested on: FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (ostrich) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (ember) w/Intel compilers, w/paralle, C++ & FORTRAN, in production mode Mac OS X/32 10.7.3 (amazon) in debug mode Mac OS X/32 10.7.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.7.3 (amazon) w/parallel, in debug mode
Diffstat (limited to 'tools/h5repack/h5repack_copy.c')
-rw-r--r--tools/h5repack/h5repack_copy.c154
1 files changed, 66 insertions, 88 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 55cf932..d38a15c 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -42,7 +42,7 @@
int _err_num = 0; \
char _msg[80]; \
H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \
- H5Eget_msg(_err_num, NULL, _msg, 80); \
+ H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \
error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \
goto error; \
} \
@@ -132,23 +132,23 @@ int copy_objects(const char* fnamein,
goto out;
}
- if(!options->fs_strategy)
- {
- if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
- {
- error_msg("failed to retrieve file space strategy\n");
- goto out;
- }
- }
-
- if(!options->fs_threshold)
- {
- if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
- {
- error_msg("failed to retrieve file space threshold\n");
- goto out;
- }
- }
+ if(!options->fs_strategy)
+ {
+ if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
+ {
+ error_msg("failed to retrieve file space strategy\n");
+ goto out;
+ }
+ }
+
+ if(!options->fs_threshold)
+ {
+ if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
+ {
+ error_msg("failed to retrieve file space threshold\n");
+ goto out;
+ }
+ }
if(H5Pclose(fcpl_in) < 0)
{
@@ -254,135 +254,113 @@ int copy_objects(const char* fnamein,
} /* end if */
} /* end if */
} /* end if */
-
-
-
-
#if defined (H5REPACK_DEBUG_USER_BLOCK)
- print_user_block(fnamein,fidin);
+ print_user_block(fnamein, fidin);
#endif
-
/*-------------------------------------------------------------------------
* set the new user userblock options in the FCPL (before H5Fcreate )
*-------------------------------------------------------------------------
*/
-
if ( options->ublock_size > 0 )
{
/* either use the FCPL already created or create a new one */
- if(fcpl != H5P_DEFAULT)
+ if(fcpl == H5P_DEFAULT)
{
- /* set user block size */
- if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
- {
- error_msg("failed to set userblock size\n");
- goto out;
- }
-
- }
-
- else
- {
-
/* create a file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
error_msg("fail to create a file creation property list\n");
goto out;
}
-
- /* set user block size */
- if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
- {
- error_msg("failed to set userblock size\n");
- goto out;
- }
-
}
-
-
+ /* set user block size */
+ if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
+ {
+ error_msg("failed to set userblock size\n");
+ goto out;
+ }
}
-
/*-------------------------------------------------------------------------
* set alignment options
*-------------------------------------------------------------------------
*/
-
-
if ( options->alignment > 0 )
{
/* either use the FAPL already created or create a new one */
- if (fapl != H5P_DEFAULT)
+ if (fapl == H5P_DEFAULT)
{
-
- if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
+ /* create a file access property list */
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
- error_msg("failed to set alignment\n");
+ error_msg("Could not create file access property list\n");
goto out;
}
-
}
- else
+ if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
{
+ error_msg("failed to set alignment\n");
+ goto out;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * set metadata block size option
+ *-------------------------------------------------------------------------
+ */
+ if ( options->meta_block_size > 0 )
+ {
+ /* either use the FAPL already created or create a new one */
+ if (fapl == H5P_DEFAULT)
+ {
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
error_msg("Could not create file access property list\n");
goto out;
}
-
- if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
- {
- error_msg("failed to set alignment\n");
- goto out;
- }
-
}
+ if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0)
+ {
+ error_msg("failed to set metadata block size\n");
+ goto out;
+ }
}
+ /*-------------------------------------------------------------------------
+ * set free-space strategy options
+ *-------------------------------------------------------------------------
+ */
+
/* either use the FCPL already created or create a new one */
- if(fcpl != H5P_DEFAULT)
+ if(fcpl == H5P_DEFAULT)
{
- /* set file space strategy and free space threshold */
- if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
- {
- error_msg("failed to set file space strategy & threshold\n");
- goto out;
- }
+ /* create a file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ {
+ error_msg("fail to create a file creation property list\n");
+ goto out;
+ }
}
- else
+
+ /* set file space strategy and free space threshold */
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
- /* create a file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- {
- error_msg("fail to create a file creation property list\n");
- goto out;
- }
-
- /* set file space strategy and free space threshold */
- if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
- {
- error_msg("failed to set file space strategy & threshold \n");
- goto out;
- }
+ error_msg("failed to set file space strategy & threshold \n");
+ goto out;
}
/*-------------------------------------------------------------------------
* create the output file
*-------------------------------------------------------------------------
*/
-
-
if(options->verbose)
printf("Making file <%s>...\n",fnameout);
-
if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
error_msg("<%s>: Could not create file\n", fnameout );