summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-02-22 19:37:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-02-22 19:37:06 (GMT)
commit727b687ae6c80c9854cb53814fa1c12f27c2994c (patch)
treefabe359aaddbe3b4d1e2bb58ceb3b94311d66a1c /tools/h5repack
parent25486d50895fa4a30809d289b9aff4de583a9b84 (diff)
downloadhdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.zip
hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.gz
hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.bz2
[svn-r20146] Description:
Bring r19714:20145 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) 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 (amani) 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 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.6 (amazon) in debug mode Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/CMakeLists.txt27
-rw-r--r--tools/h5repack/Makefile.in3
-rw-r--r--tools/h5repack/h5repack.c93
-rw-r--r--tools/h5repack/h5repack.h3
-rw-r--r--tools/h5repack/h5repack_copy.c99
-rw-r--r--tools/h5repack/h5repack_filters.c5
-rw-r--r--tools/h5repack/h5repack_main.c34
-rw-r--r--tools/h5repack/h5repack_opttable.c26
-rw-r--r--tools/h5repack/h5repack_parse.c45
-rw-r--r--tools/h5repack/h5repack_refs.c5
-rw-r--r--tools/h5repack/h5repack_verify.c1
11 files changed, 174 insertions, 167 deletions
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
index 56029fd..92933d4 100644
--- a/tools/h5repack/CMakeLists.txt
+++ b/tools/h5repack/CMakeLists.txt
@@ -21,8 +21,7 @@ SET (REPACK_COMMON_SRCS
)
ADD_EXECUTABLE (h5repack ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c)
-H5_NAMING (h5repack)
-TARGET_WIN_PROPERTIES (h5repack)
+H5_NAMING (h5repack ${LIB_TYPE})
TARGET_LINK_LIBRARIES (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5repack)
@@ -38,8 +37,7 @@ IF (BUILD_TESTING)
# Add h5Repack test executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
- H5_NAMING (testh5repack_detect_szip)
- TARGET_WIN_PROPERTIES (testh5repack_detect_szip)
+ H5_NAMING (testh5repack_detect_szip ${LIB_TYPE})
TARGET_LINK_LIBRARIES (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME testh5repack_detect_szip COMMAND $<TARGET_FILE:testh5repack_detect_szip>)
@@ -57,11 +55,11 @@ IF (BUILD_TESTING)
ENDIF (HDF5_ENABLE_SZIP_SUPPORT)
ADD_EXECUTABLE (h5repacktest ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repacktst.c)
- H5_NAMING (h5repacktest)
- TARGET_WIN_PROPERTIES (h5repacktest)
+ H5_NAMING (h5repacktest ${LIB_TYPE})
TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME h5repacktest COMMAND $<TARGET_FILE:h5repacktest>)
+ SET_TESTS_PROPERTIES (h5repacktest PROPERTIES DEPENDS testh5repack_detect_szip)
IF (HDF5_TEST_VFD)
@@ -180,10 +178,15 @@ IF (BUILD_TESTING)
NAME H5REPACK-${testname}
COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
ADD_TEST (
NAME H5REPACK-DIFF_${testname}
COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
)
+ SET_TESTS_PROPERTIES (H5REPACK-DIFF_${testname} PROPERTIES DEPENDS H5REPACK-${testname})
+ SET (last_test "H5REPACK-DIFF_${testname}")
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_TEST)
@@ -206,6 +209,10 @@ IF (BUILD_TESTING)
-D "TEST_REFERENCE=testfiles/${resultfile}.ddl"
-P "${HDF5_RESOURCES_DIR}/runTest.cmake"
)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5REPACK-${testname}")
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_CMP_TEST)
@@ -229,6 +236,8 @@ IF (BUILD_TESTING)
-D "TEST_REFERENCE=${testfilter}"
-P "${HDF5_RESOURCES_DIR}/grepTest.cmake"
)
+ SET_TESTS_PROPERTIES (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK-${testname})
+ SET (last_test "H5REPACK_VERIFY_LAYOUT-${testname}")
ELSE (${resultcode} STREQUAL "0")
IF (${testfilter} STREQUAL "CHUNKED")
SET (nottestfilter "(CONTIGUOUS|COMPACT)")
@@ -251,6 +260,8 @@ IF (BUILD_TESTING)
-D "TEST_REFERENCE=${testfilter}"
-P "${HDF5_RESOURCES_DIR}/grepTest.cmake"
)
+ SET_TESTS_PROPERTIES (H5REPACK_VERIFY_LAYOUT_ALL-${testname} PROPERTIES DEPENDS H5REPACK-${testname})
+ SET (last_test "H5REPACK_VERIFY_LAYOUT-${testname}")
ENDIF (${resultcode} STREQUAL "0")
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_VERIFY_TEST)
@@ -326,6 +337,10 @@ IF (BUILD_TESTING)
h5repack_ub_out.h5
h5repack_attr_refs_out.h5
)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5REPACK-clearall-objects")
# --------------------------------------------------------------------
# test file names
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index b4e6b48..77b6734 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -160,6 +160,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DIRECT_VFD = @DIRECT_VFD@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DYNAMIC_DIRS = @DYNAMIC_DIRS@
@@ -221,6 +222,7 @@ LTLIBOBJS = @LTLIBOBJS@
LT_STATIC_EXEC = @LT_STATIC_EXEC@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
MPI_GET_SIZE = @MPI_GET_SIZE@
@@ -277,6 +279,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index eaca09e..1e7e0ed 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -409,7 +409,7 @@ int copy_attr(hid_t loc_in,
hid_t ftype_id=-1; /* file type ID */
hid_t wtype_id=-1; /* read/write type ID */
size_t msize; /* size of type */
- void *buf=NULL; /* data buffer */
+ void *buf = NULL; /* data buffer */
hsize_t nelmts; /* number of elements in dataset */
int rank; /* rank of dataset */
htri_t is_named; /* Whether the datatype is named */
@@ -426,28 +426,23 @@ int copy_attr(hid_t loc_in,
* copy all attributes
*-------------------------------------------------------------------------
*/
-
- for ( u = 0; u < (unsigned)oinfo.num_attrs; u++)
- {
- buf=NULL;
-
+ for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
/* open attribute */
if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* get name */
- if (H5Aget_name( attr_id, (size_t)255, name ) < 0)
+ if(H5Aget_name(attr_id, (size_t)255, name) < 0)
goto error;
/* get the file datatype */
- if ((ftype_id = H5Aget_type( attr_id )) < 0 )
+ if((ftype_id = H5Aget_type(attr_id)) < 0 )
goto error;
/* Check if the datatype is committed */
if((is_named = H5Tcommitted(ftype_id)) < 0)
goto error;
- if(is_named)
- {
+ if(is_named && travt) {
hid_t fidout;
/* Create out file id */
@@ -465,29 +460,27 @@ int copy_attr(hid_t loc_in,
if(H5Fclose(fidout) < 0)
goto error;
} /* end if */
+ else {
+ if(options->use_native == 1)
+ wtype_id = h5tools_get_native_type(ftype_id);
+ else
+ wtype_id = H5Tcopy(ftype_id);
+ } /* end else */
+
/* get the dataspace handle */
- if ((space_id = H5Aget_space( attr_id )) < 0 )
+ if((space_id = H5Aget_space(attr_id)) < 0)
goto error;
/* get dimensions */
- if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 )
+ if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
goto error;
- nelmts=1;
- for (j=0; j<rank; j++)
- nelmts*=dims[j];
-
- /* wtype_id will have already been set if using a named dtype */
- if(!is_named)
- {
- if (options->use_native==1)
- wtype_id = h5tools_get_native_type(ftype_id);
- else
- wtype_id = H5Tcopy(ftype_id);
- } /* end if */
+ nelmts = 1;
+ for(j = 0; j < rank; j++)
+ nelmts *= dims[j];
- if ((msize=H5Tget_size(wtype_id))==0)
+ if((msize = H5Tget_size(wtype_id)) == 0)
goto error;
/*-------------------------------------------------------------------------
@@ -498,23 +491,20 @@ int copy_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
- if (H5T_REFERENCE==H5Tget_class(wtype_id))
- {
+ if(H5T_REFERENCE == H5Tget_class(wtype_id)) {
;
}
- else
- {
+ else {
/*-------------------------------------------------------------------------
* read to memory
*-------------------------------------------------------------------------
*/
buf = (void *)HDmalloc((size_t)(nelmts * msize));
- if(buf == NULL)
- {
+ if(buf == NULL) {
error_msg("h5repack", "cannot read into memory\n" );
goto error;
- }
+ } /* end if */
if(H5Aread(attr_id, wtype_id, buf) < 0)
goto error;
@@ -532,10 +522,12 @@ int copy_attr(hid_t loc_in,
if(H5Aclose(attr_out) < 0)
goto error;
-
- if(buf)
- free(buf);
-
+ /* Check if we have VL data in the attribute's datatype that must
+ * be reclaimed */
+ if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+ HDfree(buf);
+ buf = NULL;
} /*H5T_REFERENCE*/
@@ -547,28 +539,39 @@ int copy_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
- if (H5Tclose(ftype_id) < 0) goto error;
- if (H5Tclose(wtype_id) < 0) goto error;
- if (H5Sclose(space_id) < 0) goto error;
- if (H5Aclose(attr_id) < 0) goto error;
-
+ if(H5Tclose(ftype_id) < 0)
+ goto error;
+ if(H5Tclose(wtype_id) < 0)
+ goto error;
+ if(H5Sclose(space_id) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
} /* u */
-
return 0;
error:
H5E_BEGIN_TRY {
+ if(buf) {
+ /* Check if we have VL data in the attribute's datatype that must
+ * be reclaimed */
+ if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+
+ /* Free buf */
+ free(buf);
+ } /* end if */
+
H5Tclose(ftype_id);
H5Tclose(wtype_id);
H5Sclose(space_id);
H5Aclose(attr_id);
H5Aclose(attr_out);
- if (buf)
- free(buf);
} H5E_END_TRY;
+
return -1;
-}
+} /* end copy_attr() */
/*-------------------------------------------------------------------------
* Function: check_options
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 0e959a2..8d009a4 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -17,8 +17,7 @@
#ifndef H5REPACK_H__
#define H5REPACK_H__
-#include <assert.h>
-#include <string.h>
+#include "H5private.h"
#include "hdf5.h"
#include "h5trav.h"
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 6c47cfb..5153cc4 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -13,11 +13,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
#include "h5repack.h"
-#include "H5private.h"
#include "h5tools.h"
#include "h5tools_utils.h"
@@ -543,22 +539,23 @@ int do_copy_objects(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in=-1; /* group ID */
- hid_t grp_out=-1; /* group ID */
- hid_t dset_in=-1; /* read dataset ID */
- hid_t dset_out=-1; /* write dataset ID */
- hid_t gcpl_in=-1; /* group creation property list */
- hid_t gcpl_out=-1; /* group creation property list */
- hid_t type_in=-1; /* named type ID */
- hid_t type_out=-1; /* named type ID */
- hid_t dcpl_id=-1; /* dataset creation property list ID */
- hid_t dcpl_out=-1; /* dataset creation property list ID */
- hid_t f_space_id=-1; /* file space ID */
- hid_t ftype_id=-1; /* file type ID */
- hid_t wtype_id=-1; /* read/write type ID */
- named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes copied */
+ hid_t grp_in = -1; /* group ID */
+ hid_t grp_out = -1; /* group ID */
+ hid_t dset_in = -1; /* read dataset ID */
+ hid_t dset_out = -1; /* write dataset ID */
+ hid_t gcpl_in = -1; /* group creation property list */
+ hid_t gcpl_out = -1; /* group creation property list */
+ hid_t type_in = -1; /* named type ID */
+ hid_t type_out = -1; /* named type ID */
+ hid_t dcpl_id = -1; /* dataset creation property list ID */
+ hid_t dcpl_out = -1; /* dataset creation property list ID */
+ hid_t f_space_id = -1; /* file space ID */
+ hid_t ftype_id = -1; /* file type ID */
+ hid_t wtype_id = -1; /* read/write type ID */
+ named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
size_t msize; /* size of type */
hsize_t nelmts; /* number of elements in dataset */
+ H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
int rank; /* rank of dataset */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
hsize_t dsize_in; /* input dataset size before filter */
@@ -688,7 +685,7 @@ int do_copy_objects(hid_t fidin,
/* check if filters were requested for individual objects */
for (u = 0; u < options->op_tbl->nelems; u++) {
- if (strcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) {
+ if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) {
if (options->op_tbl->objs[u].filter->filtn > 0) {
req_filter = 1;
}
@@ -746,11 +743,13 @@ int do_copy_objects(hid_t fidin,
HDmemset(dims, 0, sizeof dims);
if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
goto error;
+
+ if(H5Dget_space_status(dset_in, &space_status) < 0)
+ goto error;
+
nelmts = 1;
- for ( j = 0; j < rank; j++)
- {
+ for(j = 0; j < rank; j++)
nelmts *= dims[j];
- }
/* wtype_id will have already been set if using a named dtype */
if(!is_named) {
@@ -834,20 +833,26 @@ int do_copy_objects(hid_t fidin,
* read/write
*-------------------------------------------------------------------------
*/
- if (nelmts)
+ if(nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED)
{
- size_t need = (size_t)(nelmts*msize); /* bytes needed */
- if ( need < H5TOOLS_MALLOCSIZE )
+ size_t need = (size_t)(nelmts * msize); /* bytes needed */
+
+ /* have to read the whole dataset if there is only one element in the dataset */
+ if(need < H5TOOLS_MALLOCSIZE)
buf = HDmalloc(need);
- if (buf != NULL )
- {
- if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0)
+ if(buf != NULL) {
+ if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
- if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0)
+ if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
- }
+ /* Check if we have VL data in the dataset's
+ * datatype that must be reclaimed */
+ if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ if(H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
+ goto error;
+ }
else /* possibly not enough memory, read/write by hyperslabs */
{
size_t p_type_nbytes = msize; /*size of memory type */
@@ -949,7 +954,7 @@ int do_copy_objects(hid_t fidin,
sm_buf=NULL;
}
} /* hyperslab read */
- }/*nelmts*/
+ } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */
/*-------------------------------------------------------------------------
* amount of compression used
@@ -1212,7 +1217,7 @@ static void print_dataset_info(hid_t dcpl_id,
int i;
- strcpy(strfilter,"\0");
+ HDstrcpy(strfilter,"\0");
/* get information about input filters */
if((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
@@ -1229,51 +1234,51 @@ static void print_dataset_info(hid_t dcpl_id,
break;
case H5Z_FILTER_DEFLATE:
- strcat(strfilter,"GZIP ");
+ HDstrcat(strfilter,"GZIP ");
#if defined (PRINT_DEBUG)
{
unsigned level=cd_values[0];
sprintf(temp,"(%d)",level);
- strcat(strfilter,temp);
+ HDstrcat(strfilter,temp);
}
#endif
break;
case H5Z_FILTER_SZIP:
- strcat(strfilter,"SZIP ");
+ HDstrcat(strfilter,"SZIP ");
#if defined (PRINT_DEBUG)
{
unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/
unsigned ppb=cd_values[1];
sprintf(temp,"(%d,",ppb);
- strcat(strfilter,temp);
+ HDstrcat(strfilter,temp);
if (options_mask & H5_SZIP_EC_OPTION_MASK)
- strcpy(temp,"EC) ");
+ HDstrcpy(temp,"EC) ");
else if (options_mask & H5_SZIP_NN_OPTION_MASK)
- strcpy(temp,"NN) ");
+ HDstrcpy(temp,"NN) ");
}
- strcat(strfilter,temp);
+ HDstrcat(strfilter,temp);
#endif
break;
case H5Z_FILTER_SHUFFLE:
- strcat(strfilter,"SHUF ");
+ HDstrcat(strfilter,"SHUF ");
break;
case H5Z_FILTER_FLETCHER32:
- strcat(strfilter,"FLET ");
+ HDstrcat(strfilter,"FLET ");
break;
case H5Z_FILTER_NBIT:
- strcat(strfilter,"NBIT ");
+ HDstrcat(strfilter,"NBIT ");
break;
case H5Z_FILTER_SCALEOFFSET:
- strcat(strfilter,"SCALEOFFSET ");
+ HDstrcat(strfilter,"SCALEOFFSET ");
break;
} /* switch */
}/*i*/
@@ -1283,10 +1288,10 @@ static void print_dataset_info(hid_t dcpl_id,
else
{
char str[255], temp[20];
- strcpy(str,"dset ");
- strcat(str,strfilter);
+ HDstrcpy(str,"dset ");
+ HDstrcat(str,strfilter);
sprintf(temp," (%.3f:1)",ratio);
- strcat(str,temp);
+ HDstrcat(str,temp);
printf(FORMAT_OBJ,str,objname);
}
}
@@ -1364,7 +1369,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
} /* end while */
/* Update size of userblock left to transfer */
- size -= nread;
+ size = size - (hsize_t)nread;
} /* end while */
done:
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index d4a3479..213ff65 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -14,7 +14,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
-#include "h5test.h"
#include "h5tools.h"
/* number of members in an array */
@@ -45,13 +44,13 @@ int aux_find_obj(const char* name, /* object name from traverse list */
for ( i=0; i<options->op_tbl->nelems; i++)
{
- if (strcmp(options->op_tbl->objs[i].path,name)==0)
+ if (HDstrcmp(options->op_tbl->objs[i].path,name)==0)
{
*obj = options->op_tbl->objs[i];
return i;
}
- pdest = strstr(name,options->op_tbl->objs[i].path);
+ pdest = HDstrstr(name,options->op_tbl->objs[i].path);
result = (int)(pdest - name);
/* found at position 1, meaning without '/' */
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 9f8a701..6ec1647 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -13,10 +13,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
#include "h5tools_utils.h"
#include "h5repack.h"
@@ -124,7 +120,7 @@ int main(int argc, const char **argv)
infile = argv[ opt_ind ];
outfile = argv[ opt_ind + 1 ];
- if ( strcmp( infile, outfile ) == 0 )
+ if ( HDstrcmp( infile, outfile ) == 0 )
{
error_msg("file names cannot be the same\n");
usage(h5tools_getprogname());
@@ -390,7 +386,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
int idx = 0;
int ssize = 0;
- char *msgPtr = strchr( opt_arg, ':');
+ char *msgPtr = HDstrchr( opt_arg, ':');
options->latest = 1; /* must use latest format */
if (msgPtr == NULL)
{
@@ -401,22 +397,22 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
else
{
char msgType[10];
- strcpy(msgType, msgPtr+1);
+ HDstrcpy(msgType, msgPtr+1);
msgPtr[0] = '\0';
ssize = atoi( opt_arg );
- if (strncmp(msgType, "dspace",6) == 0) {
+ if (HDstrncmp(msgType, "dspace",6) == 0) {
options->msg_size[0] = ssize;
}
- else if (strncmp(msgType, "dtype", 5) == 0) {
+ else if (HDstrncmp(msgType, "dtype", 5) == 0) {
options->msg_size[1] = ssize;
}
- else if (strncmp(msgType, "fill", 4) == 0) {
+ else if (HDstrncmp(msgType, "fill", 4) == 0) {
options->msg_size[2] = ssize;
}
- else if (strncmp(msgType, "pline", 5) == 0) {
+ else if (HDstrncmp(msgType, "pline", 5) == 0) {
options->msg_size[3] = ssize;
}
- else if (strncmp(msgType, "attr", 4) == 0) {
+ else if (HDstrncmp(msgType, "attr", 4) == 0) {
options->msg_size[4] = ssize;
}
}
@@ -454,14 +450,14 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
{
char strategy[MAX_NC_NAME];
- strcpy(strategy, opt_arg);
- if(!strcmp(strategy, "ALL_PERSIST"))
+ HDstrcpy(strategy, opt_arg);
+ if(!HDstrcmp(strategy, "ALL_PERSIST"))
options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST;
- else if(!strcmp(strategy, "ALL"))
+ else if(!HDstrcmp(strategy, "ALL"))
options->fs_strategy = H5F_FILE_SPACE_ALL;
- else if(!strcmp(strategy, "AGGR_VFD"))
+ else if(!HDstrcmp(strategy, "AGGR_VFD"))
options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD;
- else if(!strcmp(strategy, "VFD"))
+ else if(!HDstrcmp(strategy, "VFD"))
options->fs_strategy = H5F_FILE_SPACE_VFD;
else {
error_msg("invalid file space management strategy\n", opt_arg );
@@ -533,7 +529,7 @@ void read_info(const char *filename,
* filter
*-------------------------------------------------------------------------
*/
- if (strcmp(stype,"-f") == 0) {
+ if (HDstrcmp(stype,"-f") == 0) {
/* find begining of info */
i=0; c='0';
@@ -563,7 +559,7 @@ void read_info(const char *filename,
* layout
*-------------------------------------------------------------------------
*/
- else if (strcmp(stype,"-l") == 0) {
+ else if (HDstrcmp(stype,"-l") == 0) {
/* find begining of info */
i=0; c='0';
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index 50f97bd..57b5fa7 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -13,8 +13,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdlib.h>
-#include <string.h>
#include "h5repack.h"
#include "h5tools_utils.h"
@@ -32,7 +30,7 @@ void init_packobject(pack_info_t *obj)
{
int j, k;
- strcpy(obj->path,"\0");
+ HDstrcpy(obj->path,"\0");
for ( j=0; j<H5_REPACK_MAX_NFILTERS; j++)
{
obj->filter[j].filtn = -1;
@@ -225,7 +223,7 @@ int options_add_layout( obj_list_t *obj_list,
for (i = 0; i < table->nelems; i++)
{
/*already on the table */
- if (strcmp(obj_list[j].obj,table->objs[i].path)==0)
+ if (HDstrcmp(obj_list[j].obj,table->objs[i].path)==0)
{
/* already chunk info inserted for this one; exit */
if (table->objs[i].chunk.rank>0)
@@ -248,7 +246,7 @@ int options_add_layout( obj_list_t *obj_list,
/* keep the grow in a temp var */
I = table->nelems + added;
added++;
- strcpy(table->objs[I].path,obj_list[j].obj);
+ HDstrcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_layout(table,I,pack);
}
/* cases where we have an already inserted name but there is a new name also
@@ -256,12 +254,12 @@ int options_add_layout( obj_list_t *obj_list,
-f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
dset1 is already inserted, but dset2 must also be
*/
- else if (found==1 && strcmp(obj_list[j].obj,table->objs[i].path)!=0)
+ else if (found==1 && HDstrcmp(obj_list[j].obj,table->objs[i].path)!=0)
{
/* keep the grow in a temp var */
I = table->nelems + added;
added++;
- strcpy(table->objs[I].path,obj_list[j].obj);
+ HDstrcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_layout(table,I,pack);
}
} /* j */
@@ -275,7 +273,7 @@ int options_add_layout( obj_list_t *obj_list,
{
I = table->nelems + added;
added++;
- strcpy(table->objs[I].path,obj_list[j].obj);
+ HDstrcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_layout(table,I,pack);
}
@@ -324,7 +322,7 @@ int options_add_filter(obj_list_t *obj_list,
for (i = 0; i < table->nelems; i++)
{
/*already on the table */
- if (strcmp(obj_list[j].obj,table->objs[i].path)==0)
+ if (HDstrcmp(obj_list[j].obj,table->objs[i].path)==0)
{
/* insert */
aux_tblinsert_filter(table,i,filt);
@@ -338,7 +336,7 @@ int options_add_filter(obj_list_t *obj_list,
/* keep the grow in a temp var */
I = table->nelems + added;
added++;
- strcpy(table->objs[I].path,obj_list[j].obj);
+ HDstrcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_filter(table,I,filt);
}
/* cases where we have an already inserted name but there is a new name also
@@ -346,12 +344,12 @@ int options_add_filter(obj_list_t *obj_list,
-l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
dset1 is already inserted, but dset2 must also be
*/
- else if (found==1 && strcmp(obj_list[j].obj,table->objs[i].path)!=0)
+ else if (found==1 && HDstrcmp(obj_list[j].obj,table->objs[i].path)!=0)
{
/* keep the grow in a temp var */
I = table->nelems + added;
added++;
- strcpy(table->objs[I].path,obj_list[j].obj);
+ HDstrcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_filter(table,I,filt);
}
} /* j */
@@ -365,7 +363,7 @@ int options_add_filter(obj_list_t *obj_list,
{
I = table->nelems + added;
added++;
- strcpy(table->objs[I].path,obj_list[j].obj);
+ HDstrcpy(table->objs[I].path,obj_list[j].obj);
aux_tblinsert_filter(table,I,filt);
}
}
@@ -393,7 +391,7 @@ pack_info_t* options_get_object( const char *path,
for ( i = 0; i < table->nelems; i++)
{
/* found it */
- if (strcmp(table->objs[i].path,path)==0)
+ if (HDstrcmp(table->objs[i].path,path)==0)
{
return (&table->objs[i]);
}
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index d3a7419..d3c6014 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -13,11 +13,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-
#include "h5repack.h"
#include "h5tools_utils.h"
@@ -109,7 +104,7 @@ obj_list_t* parse_filter(const char *str,
if ( c==',' || j==end_obj-1)
{
if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
- strcpy(obj_list[n].obj,sobj);
+ HDstrcpy(obj_list[n].obj,sobj);
memset(sobj,0,sizeof(sobj));
n++;
k=-1;
@@ -143,7 +138,7 @@ obj_list_t* parse_filter(const char *str,
* example SZIP=8,NN
*-------------------------------------------------------------------------
*/
- if (strcmp(scomp,"SZIP")==0)
+ if (HDstrcmp(scomp,"SZIP")==0)
{
l=-1; /* mask index check */
for ( m=0,u=i+1; u<len; u++,m++)
@@ -171,9 +166,9 @@ obj_list_t* parse_filter(const char *str,
smask[l]='\0';
i=len-1; /* end */
(*n_objs)--; /* we counted an extra ',' */
- if (strcmp(smask,"NN")==0)
+ if (HDstrcmp(smask,"NN")==0)
filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK;
- else if (strcmp(smask,"EC")==0)
+ else if (HDstrcmp(smask,"EC")==0)
filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
else
{
@@ -203,7 +198,7 @@ obj_list_t* parse_filter(const char *str,
*-------------------------------------------------------------------------
*/
- else if (strcmp(scomp,"SOFF")==0)
+ else if (HDstrcmp(scomp,"SOFF")==0)
{
l=-1; /* mask index check */
for ( m=0,u=i+1; u<len; u++,m++)
@@ -231,9 +226,9 @@ obj_list_t* parse_filter(const char *str,
smask[l]='\0';
i=len-1; /* end */
(*n_objs)--; /* we counted an extra ',' */
- if (strcmp(smask,"IN")==0)
+ if (HDstrcmp(smask,"IN")==0)
filt->cd_values[j++]=H5Z_SO_INT;
- else if (strcmp(smask,"DS")==H5Z_SO_FLOAT_DSCALE)
+ else if (HDstrcmp(smask,"DS")==H5Z_SO_FLOAT_DSCALE)
filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE;
else
{
@@ -290,7 +285,7 @@ obj_list_t* parse_filter(const char *str,
* H5Z_FILTER_NONE
*-------------------------------------------------------------------------
*/
- if (strcmp(scomp,"NONE")==0)
+ if (HDstrcmp(scomp,"NONE")==0)
{
filt->filtn=H5Z_FILTER_NONE;
filt->cd_nelmts = 0;
@@ -300,7 +295,7 @@ obj_list_t* parse_filter(const char *str,
* H5Z_FILTER_DEFLATE
*-------------------------------------------------------------------------
*/
- else if (strcmp(scomp,"GZIP")==0)
+ else if (HDstrcmp(scomp,"GZIP")==0)
{
filt->filtn=H5Z_FILTER_DEFLATE;
filt->cd_nelmts = 1;
@@ -316,7 +311,7 @@ obj_list_t* parse_filter(const char *str,
* H5Z_FILTER_SZIP
*-------------------------------------------------------------------------
*/
- else if (strcmp(scomp,"SZIP")==0)
+ else if (HDstrcmp(scomp,"SZIP")==0)
{
filt->filtn=H5Z_FILTER_SZIP;
filt->cd_nelmts = 2;
@@ -332,7 +327,7 @@ obj_list_t* parse_filter(const char *str,
* H5Z_FILTER_SHUFFLE
*-------------------------------------------------------------------------
*/
- else if (strcmp(scomp,"SHUF")==0)
+ else if (HDstrcmp(scomp,"SHUF")==0)
{
filt->filtn=H5Z_FILTER_SHUFFLE;
filt->cd_nelmts = 0;
@@ -347,7 +342,7 @@ obj_list_t* parse_filter(const char *str,
* H5Z_FILTER_FLETCHER32
*-------------------------------------------------------------------------
*/
- else if (strcmp(scomp,"FLET")==0)
+ else if (HDstrcmp(scomp,"FLET")==0)
{
filt->filtn=H5Z_FILTER_FLETCHER32;
filt->cd_nelmts = 0;
@@ -362,7 +357,7 @@ obj_list_t* parse_filter(const char *str,
* H5Z_FILTER_NBIT
*-------------------------------------------------------------------------
*/
- else if (strcmp(scomp,"NBIT")==0)
+ else if (HDstrcmp(scomp,"NBIT")==0)
{
filt->filtn=H5Z_FILTER_NBIT;
filt->cd_nelmts = 0;
@@ -377,7 +372,7 @@ obj_list_t* parse_filter(const char *str,
* H5Z_FILTER_SCALEOFFSET
*-------------------------------------------------------------------------
*/
- else if (strcmp(scomp,"SOFF")==0)
+ else if (HDstrcmp(scomp,"SOFF")==0)
{
filt->filtn=H5Z_FILTER_SCALEOFFSET;
filt->cd_nelmts = 2;
@@ -437,7 +432,7 @@ obj_list_t* parse_filter(const char *str,
error_msg("pixels_per_block is too large in <%s>\n",str);
exit(EXIT_FAILURE);
}
- if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) )
+ if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) )
{
if (obj_list) free(obj_list);
error_msg("szip mask must be 'NN' or 'EC' \n");
@@ -530,7 +525,7 @@ obj_list_t* parse_layout(const char *str,
if ( c==',' || j==end_obj-1)
{
if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
- strcpy(obj_list[n].obj,sobj);
+ HDstrcpy(obj_list[n].obj,sobj);
memset(sobj,0,sizeof(sobj));
n++;
k=-1;
@@ -551,11 +546,11 @@ obj_list_t* parse_layout(const char *str,
if (n==5)
{
slayout[n]='\0'; /*cut string */
- if (strcmp(slayout,"COMPA")==0)
+ if (HDstrcmp(slayout,"COMPA")==0)
pack->layout=H5D_COMPACT;
- else if (strcmp(slayout,"CONTI")==0)
+ else if (HDstrcmp(slayout,"CONTI")==0)
pack->layout=H5D_CONTIGUOUS;
- else if (strcmp(slayout,"CHUNK")==0)
+ else if (HDstrcmp(slayout,"CHUNK")==0)
pack->layout=H5D_CHUNKED;
else {
error_msg("in parse layout, not a valid layout in <%s>\n",str);
@@ -618,7 +613,7 @@ obj_list_t* parse_layout(const char *str,
else if (i==len-1) { /*no more parameters */
sdim[k]='\0';
k=0;
- if (strcmp(sdim,"NONE")==0)
+ if (HDstrcmp(sdim,"NONE")==0)
{
pack->chunk.rank=-2;
}
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index aa2e823..091133e 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -14,12 +14,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
#include "h5repack.h"
-#include "H5private.h"
#include "h5diff.h"
#include "h5tools.h"
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 34c5dd6..b0ab1d1 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -14,7 +14,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
-#include "h5test.h"
#include "h5tools_utils.h"
static int verify_layout(hid_t pid, pack_info_t *obj);