summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/h5copy.c79
-rw-r--r--tools/h5copy/testh5copy.sh.in10
-rw-r--r--tools/h5diff/ph5diff_main.c5
-rw-r--r--tools/h5dump/CMakeLists.txt29
-rw-r--r--tools/h5dump/testh5dump.sh.in69
-rw-r--r--tools/h5ls/h5ls.c247
-rw-r--r--tools/h5repack/CMakeLists.txt12
-rw-r--r--tools/h5repack/h5repack.sh.in34
-rw-r--r--tools/h5repack/h5repack_copy.c10
-rw-r--r--tools/lib/CMakeLists.txt6
-rw-r--r--tools/lib/h5diff.c34
-rw-r--r--tools/lib/h5diff.h205
-rw-r--r--tools/lib/h5diff_array.c689
-rw-r--r--tools/lib/h5diff_attr.c14
-rw-r--r--tools/lib/h5tools_dump.c16
-rw-r--r--tools/lib/h5tools_utils.h2
-rw-r--r--tools/misc/h5cc.in39
-rw-r--r--tools/misc/h5mkgrp.c13
-rw-r--r--[-rwxr-xr-x]tools/misc/h5perf_gentest.c0
-rw-r--r--tools/misc/h5redeploy.in96
-rw-r--r--tools/testfiles/tfletcher32.ddl2
-rw-r--r--tools/testfiles/tshuffle.ddl2
-rw-r--r--tools/testfiles/tuserfilter.ddl4
23 files changed, 902 insertions, 715 deletions
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index 574ba94..3fb5701 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -36,6 +36,11 @@ static struct long_options l_opts[] = {
{ "version", no_arg, 'V' },
{ NULL, 0, '\0' }
};
+char *fname_src = NULL;
+char *fname_dst = NULL;
+char *oname_src = NULL;
+char *oname_dst = NULL;
+char *str_flag = NULL;
/*-------------------------------------------------------------------------
* Function: leave
@@ -54,6 +59,17 @@ static struct long_options l_opts[] = {
static void
leave(int ret)
{
+ if (fname_src)
+ HDfree(fname_src);
+ if (fname_dst)
+ HDfree(fname_dst);
+ if (oname_dst)
+ HDfree(oname_dst);
+ if (oname_src)
+ HDfree(oname_src);
+ if (str_flag)
+ HDfree(str_flag);
+
h5tools_close();
HDexit(ret);
}
@@ -199,23 +215,16 @@ static int parse_flag(const char* str_flag, unsigned *flag)
int
main (int argc, const char *argv[])
{
- hid_t fid_src=-1;
- hid_t fid_dst=-1;
- char *fname_src=NULL;
- char *fname_dst=NULL;
- char *oname_src=NULL;
- char *oname_dst=NULL;
- unsigned flag=0;
- unsigned verbose=0;
- unsigned parents=0;
+ hid_t fid_src = -1;
+ hid_t fid_dst = -1;
+ unsigned flag = 0;
+ unsigned verbose = 0;
+ unsigned parents = 0;
hid_t ocpl_id = (-1); /* Object copy property list */
hid_t lcpl_id = (-1); /* Link creation property list */
- char str_flag[20];
int opt;
int li_ret;
h5tool_link_info_t linkinfo;
- int i, len;
- char *str_ptr=NULL;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -249,7 +258,7 @@ main (int argc, const char *argv[])
usage();
leave(EXIT_FAILURE);
}
- HDstrcpy(str_flag,opt_arg);
+ str_flag = HDstrdup(opt_arg);
break;
case 'h':
@@ -341,8 +350,6 @@ main (int argc, const char *argv[])
if (fid_src==-1)
{
error_msg("Could not open input file <%s>...Exiting\n", fname_src);
- if (fname_src)
- HDfree(fname_src);
leave(EXIT_FAILURE);
}
@@ -362,10 +369,6 @@ main (int argc, const char *argv[])
if (fid_dst==-1)
{
error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
- if (fname_src)
- HDfree(fname_src);
- if (fname_dst)
- HDfree(fname_dst);
leave(EXIT_FAILURE);
}
@@ -377,8 +380,10 @@ main (int argc, const char *argv[])
{
printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n",
fname_src, oname_src, fname_dst, oname_dst);
- if (flag)
+ if (flag) {
+ HDassert(str_flag);
printf("Using %s flag\n", str_flag);
+ }
}
@@ -417,14 +422,19 @@ main (int argc, const char *argv[])
} /* end if */
else /* error, if parent groups doesn't already exist in destination file */
{
+ size_t i, len;
+
len = HDstrlen(oname_dst);
+
/* check if all the parents groups exist. skip root group */
for (i = 1; i < len; i++)
{
if ('/'==oname_dst[i])
{
- str_ptr = (char*)HDcalloc((size_t)i+1, sizeof(char));
- HDstrncpy (str_ptr, oname_dst, (size_t)i);
+ char *str_ptr;
+
+ str_ptr = (char *)HDcalloc(i + 1, sizeof(char));
+ HDstrncpy(str_ptr, oname_dst, i);
str_ptr[i]='\0';
if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0)
{
@@ -479,18 +489,7 @@ main (int argc, const char *argv[])
if (H5Fclose(fid_dst)<0)
goto error;
- if (fname_src)
- HDfree(fname_src);
- if (fname_dst)
- HDfree(fname_dst);
- if (oname_dst)
- HDfree(oname_dst);
- if (oname_src)
- HDfree(oname_src);
-
- h5tools_close();
-
- return EXIT_SUCCESS;
+ leave(EXIT_SUCCESS);
error:
printf("Error in copy...Exiting\n");
@@ -505,17 +504,7 @@ error:
H5Fclose(fid_src);
H5Fclose(fid_dst);
} H5E_END_TRY;
- if (fname_src)
- HDfree(fname_src);
- if (fname_dst)
- HDfree(fname_dst);
- if (oname_dst)
- HDfree(oname_dst);
- if (oname_src)
- HDfree(oname_src);
-
- h5tools_close();
- return EXIT_FAILURE;
+ leave(EXIT_FAILURE);
}
diff --git a/tools/h5copy/testh5copy.sh.in b/tools/h5copy/testh5copy.sh.in
index d30d8d8..bec3bfc 100644
--- a/tools/h5copy/testh5copy.sh.in
+++ b/tools/h5copy/testh5copy.sh.in
@@ -513,7 +513,7 @@ COPY_REFERENCES()
TESTFILE="$TESTDIR/h5copy_ref.h5"
echo "Test copying object and region references"
- TOOLTEST_F -f ref -i $TESTFILE -o $TESTDIR/region_ref.out.h5 -v -s / -d /COPY
+ TOOLTEST -f ref -i $TESTFILE -o $TESTDIR/region_ref.out.h5 -v -s / -d /COPY
}
# Copy external links.
@@ -529,25 +529,25 @@ COPY_EXT_LINKS()
TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_link.out.h5 -s /group_ext/extlink_dset -d /copy1_dset
echo "Test copying external link directly with -f ext"
- TOOLTEST_F -f ext -i $TESTFILE -o $TESTDIR/ext_link_f.out.h5 -v -s /group_ext/extlink_dset -d /copy2_dset
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_link_f.out.h5 -v -s /group_ext/extlink_dset -d /copy2_dset
echo "Test copying dangling external link (no obj) directly without -f ext"
TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_dangle_noobj.out.h5 -s /group_ext/extlink_notyet1 -d /copy_dangle1_1
echo "Test copying dangling external link (no obj) directly with -f ext"
- TOOLTEST_F -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_noobj_f.out.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_noobj_f.out.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2
echo "Test copying dangling external link (no file) directly without -f ext"
TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_dangle_nofile.out.h5 -s /group_ext/extlink_notyet2 -d /copy_dangle2_1
echo "Test copying dangling external link (no file) directly with -f ext"
- TOOLTEST_F -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_nofile_f.out.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_nofile_f.out.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2
echo "Test copying a group contains external links without -f ext"
TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_link_group.out.h5 -s /group_ext -d /copy1_group
echo "Test copying a group contains external links with -f ext"
- TOOLTEST_F -f ext -i $TESTFILE -o $TESTDIR/ext_link_group_f.out.h5 -v -s /group_ext -d /copy2_group
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_link_group_f.out.h5 -v -s /group_ext -d /copy2_group
}
# Test misc.
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index 1fc563b..b9bd404 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -275,6 +275,9 @@ void h5diff_exit(int status)
if(g_Parallel)
MPI_Finalize();
- exit(status);
+ /* Always exit(0), since MPI implementations do weird stuff when they
+ * receive a non-zero exit value. - QAK
+ */
+ exit(0);
}
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index f5837d4..356b41c 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -905,6 +905,33 @@ IF (BUILD_TESTING)
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO (ADD_H5ERR_MASK_TEST file)
+ MACRO (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval)
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5DUMP-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${resultfile}.out ${resultfile}.out.err
+ )
+ SET_TESTS_PROPERTIES (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ ADD_TEST (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -D "TEST_MASK_ERROR=true"
+ -D "TEST_ENV_VAR:STRING=${envvar}"
+ -D "TEST_ENV_VALUE:STRING=${envval}"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5ERR_MASK_ENV_TEST)
+
MACRO (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode)
# If using memchecker add tests without using scripts
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -1654,7 +1681,7 @@ IF (BUILD_TESTING)
ADD_H5ERR_MASK_TEST (textlink 0 --enable-error-stack textlink.h5)
# test for error stack display (BZ2048)
- ADD_H5ERR_MASK_TEST (filter_fail 1 --enable-error-stack filter_fail.h5)
+ ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5)
# test for -o -y for dataset with attributes
ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o)
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 238eee9..ceefc08 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -38,6 +38,9 @@ DIRNAME='dirname'
LS='ls'
AWK='awk'
+# Skip plugin module to test missing filter
+ENVCMD="env HDF5_PLUGIN_PRELOAD=::"
+
nerrors=0
verbose=yes
@@ -721,6 +724,70 @@ TOOLTEST4() {
}
+# same as TOOLTEST4 but disables plugin filter loading
+# silences extra error output on some platforms
+# ADD_H5ERR_MASK_TEST
+TOOLTEST5() {
+
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.oerr"
+ actual_ext="$TESTDIR/`basename $1 .ddl`.ext"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $DUMPER_BIN "$@"
+ ) >$actual 2>$actual_err
+
+ # save actual and actual_err in case they are needed later.
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ cp $actual_err $actual_err_sav
+ STDERR_FILTER $actual_err
+
+ # Extract file name, line number, version and thread IDs because they may be different
+ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
+ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
+ $actual_err > $actual_ext
+ #cat $actual_ext >> $actual
+
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ elif $CMP $expect $actual; then
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
+ fi
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
+ fi
+
+}
+
# Print a "SKIP" message
SKIP() {
TESTING $DUMPER $@
@@ -1128,7 +1195,7 @@ TOOLTEST4 textlinkfar.ddl --enable-error-stack textlinkfar.h5
TOOLTEST4 textlink.ddl --enable-error-stack textlink.h5
# test for error stack display (BZ2048)
-TOOLTEST4 filter_fail.ddl --enable-error-stack filter_fail.h5
+TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5
# test for -o -y for dataset with attributes
TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index f14a667..d4e1cb3 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -116,8 +116,8 @@ typedef struct {
hid_t gid; /* Group ID */
hbool_t symlink_target; /* Whether this is the target of an symbolic link */
symlink_trav_t *symlink_list; /* List of visited symbolic links */
- int base_len; /* Length of base path name, if not root */
- int name_start; /* # of leading characters to strip off path names on output */
+ size_t base_len; /* Length of base path name, if not root */
+ size_t name_start; /* # of leading characters to strip off path names on output */
}iter_t;
/* Command-line switches */
@@ -155,7 +155,6 @@ static struct dispatch_t {
dispatch_g[TYPE].list2 = (LIST2); \
}
-static void display_type(hid_t type, int ind);
static void print_type(h5tools_str_t *buffer, hid_t type, int ind);
static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
@@ -343,7 +342,7 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname,
int n;
if(show_file_name_g)
- sprintf(fullname, "%s/%s", iter->fname, oname + iter->name_start);
+ HDsnprintf(fullname, sizeof(fullname), "%s/%s", iter->fname, oname + iter->name_start);
else
name = oname + iter->name_start;
@@ -554,14 +553,14 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
/* If the precision is less than the total size then show the precision
* and offset on the following line. Also display the padding
* information. */
- if (8*H5Tget_size(type)!=(prec=H5Tget_precision(type))) {
+ if(8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) {
h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)",
- ind, "", (unsigned long)prec, 1==prec?"":"s",
+ ind, "", (unsigned long)prec, 1 == prec ? "" : "s",
(unsigned long)H5Tget_offset(type));
H5Tget_pad(type, &plsb, &pmsb);
- if (H5Tget_offset(type)>0) {
- switch (plsb) {
+ if(H5Tget_offset(type) > 0) {
+ switch(plsb) {
case H5T_PAD_ZERO:
plsb_s = "zero";
break;
@@ -576,12 +575,11 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
plsb_s = "unknown";
break;
default:
- ;
break;
}
}
- if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) {
- switch (pmsb) {
+ if((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) {
+ switch(pmsb) {
case H5T_PAD_ZERO:
pmsb_s = "zero";
break;
@@ -596,23 +594,22 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
pmsb_s = "unknown";
break;
default:
- ;
break;
}
}
if (plsb_s || pmsb_s) {
h5tools_str_append(buffer, "\n%*s(", ind, "");
if (plsb_s) {
- nbits = H5Tget_offset(type);
+ nbits = (unsigned)H5Tget_offset(type);
h5tools_str_append(buffer, "%lu %s bit%s at bit 0",
- (unsigned long)nbits, plsb_s, 1==nbits?"":"s");
+ (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s");
}
if (plsb_s && pmsb_s) h5tools_str_append(buffer, ", ");
if (pmsb_s) {
- nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec);
+ nbits = (8 * H5Tget_size(type)) - ((unsigned)H5Tget_offset(type) + prec);
h5tools_str_append(buffer, "%lu %s bit%s at bit %lu",
- (unsigned long)nbits, pmsb_s, 1==nbits?"":"s",
- (unsigned long)(8*H5Tget_size(type)-nbits));
+ (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s",
+ (unsigned long)(8 * H5Tget_size(type) - nbits));
}
h5tools_str_append(buffer, ")");
}
@@ -830,14 +827,18 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
char *name=NULL; /* member name */
size_t size; /* total size of type in bytes */
hid_t subtype; /* member data type */
- unsigned nmembs; /* number of members */
+ int nmembs; /* number of members */
int n; /* miscellaneous counters */
unsigned i; /* miscellaneous counters */
- if (H5T_COMPOUND!=H5Tget_class(type)) return FALSE;
+ if(H5T_COMPOUND != H5Tget_class(type))
+ return FALSE;
+ nmembs = H5Tget_nmembers(type);
+ if(nmembs <= 0)
+ return FALSE;
+
h5tools_str_append(buffer, "struct {");
- nmembs=H5Tget_nmembers(type);
- for (i=0; i<nmembs; i++) {
+ for(i = 0; i < (unsigned)nmembs; i++) {
/* Name and offset */
name = H5Tget_member_name(type, i);
@@ -878,89 +879,109 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- char **name=NULL; /* member names */
- unsigned char *value=NULL; /* value array */
- unsigned char *copy = NULL; /* a pointer to value array */
- unsigned nmembs; /* number of members */
- int nchars; /* number of output characters */
+ int nmembs; /* number of members */
hid_t super; /* enum base integer type */
- hid_t native=-1; /* native integer data type */
- size_t dst_size; /* destination value type size */
- unsigned i; /* miscellaneous counters */
- size_t j;
- if (H5T_ENUM!=H5Tget_class(type)) return FALSE;
+ if(H5T_ENUM != H5Tget_class(type))
+ return FALSE;
nmembs = H5Tget_nmembers(type);
- HDassert(nmembs>0);
+ if(nmembs < 0)
+ return FALSE;
+
super = H5Tget_super(type);
h5tools_str_append(buffer, "enum ");
- print_type(buffer, super, ind+4);
+ print_type(buffer, super, ind + 4);
h5tools_str_append(buffer, " {");
- /* Determine what data type to use for the native values. To simplify
- * things we entertain three possibilities:
- * 1. long long -- the largest native signed integer
- * 2. unsigned long long -- the largest native unsigned integer
- * 3. raw format */
- if (H5Tget_size(type)<=sizeof(long long)) {
- dst_size = sizeof(long long);
- if (H5T_SGN_NONE==H5Tget_sign(type)) {
- native = H5T_NATIVE_ULLONG;
- } else {
- native = H5T_NATIVE_LLONG;
+ if(nmembs > 0) {
+ char **name; /* member names */
+ unsigned char *value; /* value array */
+ hid_t native = -1; /* native integer data type */
+ size_t dst_size; /* destination value type size */
+ unsigned i; /* miscellaneous counters */
+
+ /* Determine what data type to use for the native values. To simplify
+ * things we entertain three possibilities:
+ * 1. long long -- the largest native signed integer
+ * 2. unsigned long long -- the largest native unsigned integer
+ * 3. raw format */
+ if(H5Tget_size(type) <= sizeof(long long)) {
+ dst_size = sizeof(long long);
+ if(H5T_SGN_NONE == H5Tget_sign(type))
+ native = H5T_NATIVE_ULLONG;
+ else
+ native = H5T_NATIVE_LLONG;
+ } /* end if */
+ else
+ dst_size = H5Tget_size(type);
+
+ /* Get the names and raw values of all members */
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
+ for(i = 0; i < (unsigned)nmembs; i++) {
+ name[i] = H5Tget_member_name(type, i);
+ H5Tget_member_value(type, i, value + i * H5Tget_size(type));
}
- } else {
- dst_size = H5Tget_size(type);
- }
-
- /* Get the names and raw values of all members */
- name = HDcalloc(nmembs, sizeof(char*));
- value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size));
- for (i=0; i<nmembs; i++) {
- name[i] = H5Tget_member_name(type, i);
- H5Tget_member_value(type, i, value+i*H5Tget_size(type));
- }
- /* Convert values to native data type */
- if (native>0) H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT);
+ /* Convert values to native data type */
+ if(native > 0)
+ if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) {
+ /* Release resources */
+ for(i = 0; i < (unsigned)nmembs; i++)
+ HDfree(name[i]);
+ HDfree(name);
+ HDfree(value);
- /* Sort members by increasing value */
- /*not implemented yet*/
-
- /* Print members */
- for (i=0; i<nmembs; i++) {
- h5tools_str_append(buffer, "\n%*s", ind+4, "");
- nchars = print_string(buffer, name[i], TRUE);
- h5tools_str_append(buffer, "%*s = ", MAX(0, 16-nchars), "");
+ return FALSE;
+ }
- if (native<0) {
- h5tools_str_append(buffer, "0x");
- for (j=0; j<dst_size; j++)
- h5tools_str_append(buffer, "%02x", value[i*dst_size+j]);
- }
- else if (H5T_SGN_NONE==H5Tget_sign(native)) {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value+i*dst_size;
- h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long*)((void*)copy)));
- }
- else {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value+i*dst_size;
- h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d",
- *((long long*)((void*)copy)));
+ /* Sort members by increasing value */
+ /*not implemented yet*/
+
+ /* Print members */
+ for(i = 0; i < (unsigned)nmembs; i++) {
+ unsigned char *copy; /* a pointer to value array */
+ int nchars; /* number of output characters */
+
+ h5tools_str_append(buffer, "\n%*s", ind+4, "");
+ nchars = print_string(buffer, name[i], TRUE);
+ h5tools_str_append(buffer, "%*s = ", MAX(0, 16 - nchars), "");
+
+ if(native < 0) {
+ size_t j;
+
+ h5tools_str_append(buffer, "0x");
+ for(j = 0; j < dst_size; j++)
+ h5tools_str_append(buffer, "%02x", value[i*dst_size+j]);
+ }
+ else if(H5T_SGN_NONE == H5Tget_sign(native)) {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value + i * dst_size;
+ h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long*)((void*)copy)));
+ }
+ else {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value + i * dst_size;
+ h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d",
+ *((long long*)((void*)copy)));
+ }
}
+
+ /* Release resources */
+ for(i = 0; i < (unsigned)nmembs; i++)
+ HDfree(name[i]);
+ HDfree(name);
+ HDfree(value);
}
+ else
+ h5tools_str_append(buffer, "\n%*s <empty>", ind+4, "");
+
+ h5tools_str_append(buffer, "\n%*s}", ind, "");
- /* Release resources */
- for (i=0; i<nmembs; i++) HDfree(name[i]);
- HDfree(name);
- HDfree(value);
H5Tclose(super);
- if (0==nmembs) h5tools_str_append(buffer, "\n%*s <empty>", ind+4, "");
- h5tools_str_append(buffer, "\n%*s}", ind, "");
return TRUE;
}
@@ -1190,10 +1211,11 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
int ndims, i;
hsize_t *dims=NULL;
- if (H5T_ARRAY!=H5Tget_class(type)) return FALSE;
+ if (H5T_ARRAY!=H5Tget_class(type))
+ return FALSE;
ndims = H5Tget_array_ndims(type);
if (ndims) {
- dims = (hsize_t *)HDmalloc(ndims*sizeof(dims[0]));
+ dims = (hsize_t *)HDmalloc((unsigned)ndims * sizeof(dims[0]));
H5Tget_array_dims2(type, dims);
/* Print dimensions */
@@ -1203,9 +1225,8 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
HDfree(dims);
}
- else {
+ else
h5tools_str_append(buffer, " [SCALAR]\n", rawoutstream);
- }
/* Print parent type */
@@ -1391,7 +1412,7 @@ dump_dataset_values(hid_t dset)
outputformat.line_per_line = 1;
}
else {
- outputformat.line_ncols = width_g;
+ outputformat.line_ncols = (unsigned)width_g;
}
if (label_g) outputformat.cmpd_name = "%s=";
outputformat.line_pre = " %s ";
@@ -1413,9 +1434,9 @@ dump_dataset_values(hid_t dset)
}
outputformat.arr_linebreak = 0;
/* Floating point types should display full precision */
- sprintf(fmt_float, "%%1.%dg", FLT_DIG);
+ HDsnprintf(fmt_float, sizeof(fmt_float), "%%1.%dg", FLT_DIG);
outputformat.fmt_float = fmt_float;
- sprintf(fmt_double, "%%1.%dg", DBL_DIG);
+ HDsnprintf(fmt_double, sizeof(fmt_double), "%%1.%dg", DBL_DIG);
outputformat.fmt_double = fmt_double;
if (hexdump_g) {
@@ -1429,8 +1450,7 @@ dump_dataset_values(hid_t dset)
outputformat.ascii = TRUE;
outputformat.elmt_suf1 = "";
outputformat.elmt_suf2 = "";
- strcpy(string_prefix, outputformat.line_pre);
- strcat(string_prefix, "\"");
+ HDsnprintf(string_prefix, sizeof(string_prefix), "%s\"", outputformat.line_pre);
outputformat.line_pre = string_prefix;
outputformat.line_suf = "\"";
}
@@ -1488,7 +1508,6 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
size_t need;
int ndims;
int i;
- int n;
void *buf;
H5S_class_t space_type;
hsize_t curr_pos = 0; /* total data element position */
@@ -1503,7 +1522,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Attribute: ");
- n = print_string(&buffer, attr_name, TRUE);
+ print_string(&buffer, attr_name, TRUE);
if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) {
space = H5Aget_space(attr);
@@ -1536,6 +1555,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0);
break;
+ case H5S_NO_CLASS:
default:
/* Unknown dataspace type */
h5tools_str_append(&buffer, " unknown\n");
@@ -1571,7 +1591,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
outputformat.str_repeat = 8;
}
- outputformat.line_ncols = width_g;
+ outputformat.line_ncols = (unsigned)width_g;
if(label_g)
outputformat.cmpd_name = "%s=";
if(string_g && 1==H5Tget_size(type) &&
@@ -1778,7 +1798,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
}
/* Print total raw storage size */
- total = H5Sget_simple_extent_npoints(space) * H5Tget_size(type);
+ total = (hsize_t)H5Sget_simple_extent_npoints(space) * H5Tget_size(type);
used = H5Dget_storage_size(dset);
tclass = H5Tget_class(type);
h5tools_str_append(&buffer, " %-10s ", "Storage:");
@@ -1796,13 +1816,24 @@ dataset_list2(hid_t dset, const char UNUSED *name)
}
break;
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ case H5T_NCLASSES:
default:
h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s",
total, 1==total?"":"s",
used, 1==used?"":"s");
if (used>0)
{
- utilization = (total*100.0)/used;
+ utilization = ((double)total * (double)100.0f) / (double)used;
h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization);
}
}
@@ -1812,7 +1843,8 @@ dataset_list2(hid_t dset, const char UNUSED *name)
/* Print information about external strorage */
if((nf = H5Pget_external_count(dcpl)) > 0) {
for(i = 0, max_len = 0; i < nf; i++) {
- H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL);
+ if(H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0)
+ continue;
n = print_string(NULL, f_name, TRUE);
max_len = MAX(max_len, n);
} /* end for */
@@ -1858,7 +1890,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
f_name[sizeof(f_name) - 1] = '\0';
- sprintf(s, "Filter-%d:", i);
+ HDsnprintf(s, sizeof(s), "Filter-%d:", i);
h5tools_str_append(&buffer, " %-10s %s-%u %s {", s,
(f_name[0] ? f_name : "method"),
(unsigned)filt_id,
@@ -2055,7 +2087,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (cmt_bufsize > 0) {
comment = (char *)HDmalloc((size_t)cmt_bufsize + 1); /* new_size including null terminator */
if(comment) {
- cmt_bufsize = H5Oget_comment(obj, comment, cmt_bufsize);
+ cmt_bufsize = H5Oget_comment(obj, comment, (size_t)cmt_bufsize);
if(cmt_bufsize > 0) {
comment[cmt_bufsize] = 0;
h5tools_str_reset(&buffer);
@@ -2268,6 +2300,9 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
}
break;
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
default:
h5tools_str_append(&buffer, "UD Link {cannot follow UD links}\n");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0);
@@ -2458,7 +2493,7 @@ get_width(void)
static hbool_t
is_valid_args(void)
{
- herr_t ret = TRUE;
+ hbool_t ret = TRUE;
if(recursive_g && grp_literal_g)
{
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
index 156f6d8..06c6b71 100644
--- a/tools/h5repack/CMakeLists.txt
+++ b/tools/h5repack/CMakeLists.txt
@@ -881,6 +881,18 @@ ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIM
# file input - should not fail
ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE)
+#--------------------------------------------------------------------------
+# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset
+# (dset size < 64K) and with unlimited max dims on a condition as follow.
+# (HDFFV-8214)
+#--------------------------------------------------------------------------
+# chunk dim is bigger than dataset dim. should succeed.
+ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI)
+# chunk dim is smaller than dataset dim. should succeed.
+ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI)
+
+
+
# Native option
# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
# report a difference.
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index dc90426..ca25183 100644
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -244,8 +244,11 @@ VERIFY_LAYOUT_DSET()
shift
shift
shift
-
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+
+ TESTING $H5REPACK $@
+ (
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
RET=$?
if [ $RET != 0 ] ; then
echo "*FAILED*"
@@ -266,6 +269,7 @@ VERIFY_LAYOUT_DSET()
echo " PASSED"
else
echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
fi
# clean up tmp files
@@ -277,6 +281,7 @@ VERIFY_LAYOUT_DSET()
# Verifying layouts from entire file
VERIFY_LAYOUT_ALL()
{
+ infile=$2
outfile=$TESTDIR/out-$1.$2
layoutfile=$TESTDIR/layout-$1.$2
expectlayout=$3
@@ -284,7 +289,10 @@ VERIFY_LAYOUT_ALL()
shift
shift
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ TESTING $H5REPACK $@
+ (
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
RET=$?
if [ $RET != 0 ] ; then
echo "*FAILED*"
@@ -300,6 +308,7 @@ VERIFY_LAYOUT_ALL()
# check if the other layouts still exsit
VERIFY "layouts"
(
+ echo
# if CONTIGUOUS
if [ $expectlayout = "CONTIGUOUS" ]; then
TESTING $H5DUMP_BIN -pH $outfile
@@ -309,10 +318,12 @@ VERIFY_LAYOUT_ALL()
$GREP "COMPACT" $layoutfile > /dev/null
if [ $? -eq 0 ]; then
echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
else
$GREP "CHUNKED" $layoutfile > /dev/null
if [ $? -eq 0 ]; then
echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
@@ -327,10 +338,12 @@ VERIFY_LAYOUT_ALL()
$GREP "CHUNKED" $layoutfile > /dev/null
if [ $? -eq 0 ]; then
echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
else
$GREP "CONTIGUOUS" $layoutfile > /dev/null
if [ $? -eq 0 ]; then
echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
@@ -345,10 +358,12 @@ VERIFY_LAYOUT_ALL()
$GREP "CONTIGUOUS" $layoutfile > /dev/null
if [ $? -eq 0 ]; then
echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
else
$GREP "COMPACT" $layoutfile > /dev/null
if [ $? -eq 0 ]; then
echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
@@ -523,6 +538,7 @@ TOOLTEST_META()
else
#fail
echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
fi
rm -f $outfile
@@ -891,6 +907,18 @@ VERIFY_LAYOUT_DSET error3 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED -f ch
# file input - should not fail
TOOLTEST error4 h5repack_layout3.h5 -f NONE
+#--------------------------------------------------------------------------
+# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset
+# (dset size < 64K) and with unlimited max dims on a condition as follow.
+# (HDFFV-8214)
+#--------------------------------------------------------------------------
+
+# chunk dim is bigger than dataset dim. should succeed.
+VERIFY_LAYOUT_DSET ckdim_biger h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI
+# chunk dim is smaller than dataset dim. should succeed.
+VERIFY_LAYOUT_DSET ckdim_smaller h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI
+
+
# Native option
# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
# report a difference.
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 02337fd..f9dd334 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -1017,16 +1017,6 @@ int do_copy_objects(hid_t fidin,
/* get the storage size of the input dataset */
dsize_in=H5Dget_storage_size(dset_in);
- /* check for small size datasets (less than 1k) except
- * changing to COMPACT. For the reference, COMPACT is limited
- * by size 64K by library.
- */
- if (options->layout_g != H5D_COMPACT)
- {
- if ( size_dset < options->min_comp )
- apply_s=0;
- }
-
/* apply the filter */
if (apply_s)
{
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index f0d0d01..ac86e8a 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -38,15 +38,15 @@ SET (H5_TOOLS_LIB_HDRS
ADD_LIBRARY (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS})
TARGET_LINK_LIBRARIES (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
-SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}")
+SET_GLOBAL_VARIABLE(HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}")
H5_SET_LIB_OPTIONS (
${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME}
${LIB_TYPE}
HDF5_TOOLS_LIB_NAME_RELEASE
HDF5_TOOLS_LIB_NAME_DEBUG
)
-#SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES COMPILE_DEFINITIONS H5DIFF_DEBUG)
-SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES FOLDER libraries/tools)
+#SET_TARGET_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS H5DIFF_DEBUG)
+SET_TARGET_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools)
##############################################################################
##############################################################################
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 2b4fa29..1752155 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -241,7 +241,6 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options
struct exclude_path_list * exclude_path_ptr;
int ret_cmp;
int ret = 0;
- int len_grp;
/* check if exclude path option is given */
if (!options->exclude_path)
@@ -260,6 +259,8 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options
HDstrlen(exclude_path_ptr->obj_path));
if (ret_cmp == 0) /* found matching members */
{
+ size_t len_grp;
+
/* check if given path belong to an excluding group, if so
* exclude it as well.
* This verifies if “/grp1/dset1” is only under “/grp1”, but
@@ -338,7 +339,6 @@ static void free_exclude_path_list(diff_opt_t *options)
*------------------------------------------------------------------------*/
static void build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2, trav_table_t ** table_out, diff_opt_t *options)
{
- unsigned i;
size_t curr1 = 0;
size_t curr2 = 0;
unsigned infile[2];
@@ -346,8 +346,8 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
char * path2_lp;
h5trav_type_t type1_l;
h5trav_type_t type2_l;
- int path1_offset = 0;
- int path2_offset = 0;
+ size_t path1_offset = 0;
+ size_t path2_offset = 0;
int cmp;
trav_table_t *table;
size_t idx;
@@ -616,8 +616,8 @@ hsize_t h5diff(const char *fname1,
int i;
int l_ret1 = -1;
int l_ret2 = -1;
- const char * obj1fullname = NULL;
- const char * obj2fullname = NULL;
+ char * obj1fullname = NULL;
+ char * obj2fullname = NULL;
int both_objs_grp = 0;
/* init to group type */
h5trav_type_t obj1type = H5TRAV_TYPE_GROUP;
@@ -701,26 +701,26 @@ hsize_t h5diff(const char *fname1,
/* make the given object1 fullpath, start with "/" */
if (HDstrncmp(objname1, "/", 1))
{
- HDstrcpy((char *)obj1fullname, "/");
- HDstrcat((char *)obj1fullname, objname1);
+ HDstrcpy(obj1fullname, "/");
+ HDstrcat(obj1fullname, objname1);
}
else
- HDstrcpy((char *)obj1fullname, objname1);
+ HDstrcpy(obj1fullname, objname1);
/* make the given object2 fullpath, start with "/" */
if (HDstrncmp(objname2, "/", 1))
{
- HDstrcpy((char *)obj2fullname, "/");
- HDstrcat((char *)obj2fullname, objname2);
+ HDstrcpy(obj2fullname, "/");
+ HDstrcat(obj2fullname, objname2);
}
else
- HDstrcpy((char *)obj2fullname, objname2);
+ HDstrcpy(obj2fullname, objname2);
/*----------------------------------------------------------
* check if obj1 is root, group, single object or symlink
*/
h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n");
- if(!HDstrcmp((char *)obj1fullname, "/"))
+ if(!HDstrcmp(obj1fullname, "/"))
{
obj1type = H5TRAV_TYPE_GROUP;
}
@@ -840,10 +840,10 @@ hsize_t h5diff(const char *fname1,
h5difftrace("h5diff no object specified\n");
/* set root group */
obj1fullname = (char*)HDcalloc(2, sizeof(char));
- HDstrcat((char *)obj1fullname, "/");
+ HDstrcat(obj1fullname, "/");
obj1type = H5TRAV_TYPE_GROUP;
obj2fullname = (char*)HDcalloc(2, sizeof(char));
- HDstrcat((char *)obj2fullname, "/");
+ HDstrcat(obj2fullname, "/");
obj2type = H5TRAV_TYPE_GROUP;
}
@@ -1078,9 +1078,9 @@ out:
/* free buffers */
if (obj1fullname)
- HDfree((char *)obj1fullname);
+ HDfree(obj1fullname);
if (obj2fullname)
- HDfree((char *)obj2fullname);
+ HDfree(obj2fullname);
/* free link info buffer */
if (trg_linfo1.trg_path)
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 2530805..9e1c8bb 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -196,210 +196,5 @@ int print_objname(diff_opt_t *options, hsize_t nfound);
void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts);
void do_print_attrname (const char *attr, const char *path1, const char *path2);
-
-/*-------------------------------------------------------------------------
- * XCAO, 11/10/2010
- * added to improve performance for compound datasets
- */
-typedef struct mcomp_t
-{
- int n; /* number of members */
- hid_t *ids; /* member type id */
- unsigned char *flags;
- size_t *offsets;
- struct mcomp_t **m; /* members */
-}mcomp_t;
-
-hsize_t diff_datum(void *_mem1,
- void *_mem2,
- hid_t m_type,
- hsize_t i,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- hid_t container1_id,
- hid_t container2_id, /*where the reference came from*/
- int *ph, /*print header */
- mcomp_t *members); /*compound members */
-
-
-
-hsize_t diff_float(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_double(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-#if H5_SIZEOF_LONG_DOUBLE !=0
-
-hsize_t diff_ldouble(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-#endif
-
-hsize_t diff_schar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_uchar(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_short(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_ushort(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_int(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_uint(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_long(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_ulong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_llong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
-hsize_t diff_ullong(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- int *ph);
-
#endif /* H5DIFF_H__ */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 1e7f88b..528fc40 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -36,7 +36,6 @@
#endif
#define I_FORMAT "%-15d %-15d %-15d\n"
-#define C_FORMAT "%-16c %-17c\n"
#define S_FORMAT "%-16s %-17s\n"
#define UI_FORMAT "%-15u %-15u %-15u\n"
#define LI_FORMAT "%-15ld %-15ld %-15ld\n"
@@ -101,43 +100,44 @@
*-------------------------------------------------------------------------
*/
-static int not_comparable;
+static hbool_t not_comparable;
-#define PER(A,B) { per=-1; \
- not_comparable=0; \
- both_zero=0; \
- if (A==0 && B==0) \
- both_zero=1; \
- if (A!=0) \
- per = (double)ABS( ( double)(B-A) / (double)A ); \
+#define PER(A,B) { \
+ per = -1; \
+ not_comparable = FALSE; \
+ both_zero = FALSE; \
+ if(0 == (A) && 0 == (B)) \
+ both_zero = TRUE; \
+ if(0 != (A)) \
+ per = (double)ABS((double)(B - A) / (double)A); \
else \
- not_comparable=1; \
+ not_comparable = TRUE; \
}
-#define PER_UNSIGN(TYPE,A,B) { per=-1; \
- not_comparable=0; \
- both_zero=0; \
- if (A==0 && B==0) \
- both_zero=1; \
- if (A!=0) \
- per = ABS((double)((TYPE)(B-A)) / (double)A) ; \
+#define PER_UNSIGN(TYPE,A,B) { \
+ per = -1; \
+ not_comparable = FALSE; \
+ both_zero = FALSE; \
+ if(A == 0 && B == 0) \
+ both_zero = TRUE; \
+ if(A != 0) \
+ per = ABS((double)((TYPE)(B - A)) / (double)A) ; \
else \
- not_comparable=1; \
+ not_comparable = TRUE; \
}
-#define BOTH_ZERO(A,B) { both_zero=0; \
- if (A==0 && B==0) \
- both_zero=1; \
-}
+# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b))
-#define IS_ZERO(A) { is_zero=0; \
- if (A==0) \
- is_zero=1; \
-}
+typedef struct mcomp_t
+{
+ unsigned n; /* number of members */
+ hid_t *ids; /* member type id */
+ size_t *offsets;
+ struct mcomp_t **m; /* members */
+}mcomp_t;
-# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b))
/*-------------------------------------------------------------------------
* local prototypes
@@ -146,7 +146,7 @@ static int not_comparable;
static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id,hid_t region1_id, hid_t region2_id, diff_opt_t *options);
static hbool_t all_zero(const void *_mem, size_t size);
static int ull2float(unsigned long long ull_value, float *f_value);
-static hsize_t character_compare(unsigned char *mem1,unsigned char *mem2,hsize_t i,unsigned u,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
+static hsize_t character_compare(char *mem1,char *mem2,hsize_t i,unsigned u,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
static hbool_t equal_float(float value, float expected, diff_opt_t *options);
static hbool_t equal_double(double value, double expected, diff_opt_t *options);
@@ -157,6 +157,179 @@ static int print_data(diff_opt_t *options);
static void print_pos(int *ph,int pp,hsize_t curr_pos,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 );
static void print_char_pos(int *ph,int pp,hsize_t curr_pos,unsigned u,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 );
static void h5diff_print_char(char ch);
+static hsize_t diff_datum(void *_mem1,
+ void *_mem2,
+ hid_t m_type,
+ hsize_t i,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ hid_t container1_id,
+ hid_t container2_id, /*where the reference came from*/
+ int *ph, /*print header */
+ mcomp_t *members); /*compound members */
+static hsize_t diff_float(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_double(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+#if H5_SIZEOF_LONG_DOUBLE !=0
+static hsize_t diff_ldouble(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+#endif
+static hsize_t diff_schar(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_uchar(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_short(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_ushort(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_int(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_uint(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_long(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_ulong(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_llong(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
+static hsize_t diff_ullong(unsigned char *mem1,
+ unsigned char *mem2,
+ hsize_t nelmts,
+ hsize_t hyper_start,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ int *ph);
/*-------------------------------------------------------------------------
@@ -180,7 +353,7 @@ typedef enum dtype_t
} dtype_t;
#endif
-static int my_isnan(dtype_t type, void *val);
+static hbool_t my_isnan(dtype_t type, void *val);
/*-------------------------------------------------------------------------
* XCAO, 11/10/2010
@@ -260,6 +433,9 @@ hsize_t diff_array( void *_mem1,
switch (type_class)
{
+ case H5T_NO_CLASS:
+ case H5T_TIME:
+ case H5T_NCLASSES:
default:
HDassert(0);
break;
@@ -387,21 +563,21 @@ hsize_t diff_array( void *_mem1,
* Dereference the object and compare the type (basic object type).
*-------------------------------------------------------------------------
*/
-hsize_t diff_datum(void *_mem1,
- void *_mem2,
- hid_t m_type,
- hsize_t i,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *options,
- const char *obj1,
- const char *obj2,
- hid_t container1_id,
- hid_t container2_id, /*where the reference came from*/
- int *ph, /*print header */
- mcomp_t *members) /*compound members */
+static hsize_t diff_datum(void *_mem1,
+ void *_mem2,
+ hid_t m_type,
+ hsize_t i,
+ int rank,
+ hsize_t *dims,
+ hsize_t *acc,
+ hsize_t *pos,
+ diff_opt_t *options,
+ const char *obj1,
+ const char *obj2,
+ hid_t container1_id,
+ hid_t container2_id, /*where the reference came from*/
+ int *ph, /*print header */
+ mcomp_t *members) /*compound members */
{
unsigned char *mem1 = (unsigned char*)_mem1;
unsigned char *mem2 = (unsigned char*)_mem2;
@@ -411,19 +587,19 @@ hsize_t diff_datum(void *_mem1,
H5T_sign_t type_sign;
H5T_class_t type_class;
size_t offset;
- int nmembs;
- int j;
+ unsigned nmembs;
+ unsigned j;
hsize_t nelmts;
size_t size=0;
- int iszero1;
- int iszero2;
+ hbool_t iszero1;
+ hbool_t iszero2;
hid_t obj1_id;
hid_t obj2_id;
hsize_t nfound=0; /* differences found */
int ret=0; /* check return error */
float f1, f2;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_datum start\n");
type_size = H5Tget_size( m_type );
@@ -442,10 +618,10 @@ hsize_t diff_datum(void *_mem1,
switch (H5Tget_class(m_type))
{
- default:
- HDassert(0);
- break;
+ case H5T_NO_CLASS:
case H5T_TIME:
+ case H5T_NCLASSES:
+ default:
HDassert(0);
break;
@@ -464,8 +640,8 @@ hsize_t diff_datum(void *_mem1,
memb_type = members->ids[j];
nfound+=diff_datum(
- mem1+offset,
- mem2+offset,
+ mem1 + offset,
+ mem2 + offset,
memb_type,
i,
rank,
@@ -508,10 +684,10 @@ hsize_t diff_datum(void *_mem1,
else
{
/* Get pointer to first string */
- s1 = mem1;
+ s1 = (char *)mem1;
size1 = H5Tget_size(m_type);
/* Get pointer to second string */
- s2 = mem2;
+ s2 = (char *)mem2;
size2 = H5Tget_size(m_type);
}
@@ -634,11 +810,11 @@ hsize_t diff_datum(void *_mem1,
*/
err1 = H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1);
if(err1 < 0)
- strcpy(enum_name1, "**INVALID VALUE**");
+ HDsnprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**");
err2 = H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2);
if(err2 < 0)
- strcpy(enum_name2, "**INVALID VALUE**");
+ HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**");
if(err1 < 0 || err2 < 0)
{
@@ -702,7 +878,8 @@ hsize_t diff_datum(void *_mem1,
{
hsize_t adims[H5S_MAX_RANK];
- hsize_t ndims;
+ int ndims;
+
/* get the array's base datatype for each element */
memb_type = H5Tget_super(m_type);
size = H5Tget_size(memb_type);
@@ -711,7 +888,7 @@ hsize_t diff_datum(void *_mem1,
HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
/* calculate the number of array elements */
- for (u = 0, nelmts = 1; u <ndims; u++)
+ for (u = 0, nelmts = 1; u < (unsigned)ndims; u++)
nelmts *= adims[u];
for (u = 0; u < nelmts; u++)
{
@@ -861,22 +1038,22 @@ hsize_t diff_datum(void *_mem1,
/* get the number of sequence elements */
nelmts = ((hvl_t *)mem1)->len;
- for (j = 0; j < (int)nelmts; j++)
- nfound+=diff_datum(
- ((char *)(((hvl_t *)mem1)->p)) + j * size,
- ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */
- memb_type,
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- container1_id,
- container2_id,
- ph, members);
+ for (j = 0; j < nelmts; j++)
+ nfound += diff_datum(
+ ((char *)(((hvl_t *)mem1)->p)) + j * size,
+ ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */
+ memb_type,
+ i, /* index position */
+ rank,
+ dims,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ container1_id,
+ container2_id,
+ ph, members);
H5Tclose(memb_type);
@@ -1421,7 +1598,7 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(UI_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
}
nfound++;
}
@@ -1434,7 +1611,7 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per);
+ parallel_print(UI_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per);
}
nfound++;
}
@@ -1450,7 +1627,7 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ parallel_print(UI_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
}
nfound++;
}
@@ -1463,7 +1640,7 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per);
+ parallel_print(UI_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per);
}
nfound++;
}
@@ -1904,8 +2081,8 @@ hsize_t diff_datum(void *_mem1,
{
float temp1_float;
float temp2_float;
- int isnan1=0;
- int isnan2=0;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
HDassert(type_size==sizeof(float));
@@ -1933,29 +2110,29 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
- if (ABS(temp1_float-temp2_float) > options->delta)
+ if (ABS(temp1_float-temp2_float) > (float)options->delta)
{
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT,(double)temp1_float,(double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
@@ -1979,7 +2156,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_float,temp2_float);
@@ -1990,35 +2167,35 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
else
- if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta )
+ if ( per > options->percent && (double)ABS(temp1_float-temp2_float) > options->delta )
{
if ( print_data(options) )
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_float,temp2_float,
- ABS(temp1_float-temp2_float),
- ABS(1-temp2_float/temp1_float));
+ parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float),
+ (double)ABS(1 - temp2_float / temp1_float));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
@@ -2044,7 +2221,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_float,temp2_float);
@@ -2055,8 +2232,8 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,
- ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
@@ -2069,22 +2246,22 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_float,temp2_float,
- ABS(temp1_float-temp2_float),
- ABS(1-temp2_float/temp1_float));
+ parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float),
+ (double)ABS(1 - temp2_float / temp1_float));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
@@ -2102,7 +2279,7 @@ hsize_t diff_datum(void *_mem1,
{
print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
@@ -2117,8 +2294,8 @@ hsize_t diff_datum(void *_mem1,
{
double temp1_double;
double temp2_double;
- int isnan1=0;
- int isnan2=0;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
HDassert(type_size==sizeof(double));
@@ -2144,7 +2321,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
if (ABS(temp1_double-temp2_double) > options->delta)
@@ -2160,7 +2337,7 @@ hsize_t diff_datum(void *_mem1,
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -2191,7 +2368,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -2225,7 +2402,7 @@ hsize_t diff_datum(void *_mem1,
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -2256,7 +2433,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -2291,7 +2468,7 @@ hsize_t diff_datum(void *_mem1,
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -2331,8 +2508,8 @@ hsize_t diff_datum(void *_mem1,
{
long double temp1_double;
long double temp2_double;
- int isnan1=0;
- int isnan2=0;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
HDassert(type_size==sizeof(long double));
@@ -2360,7 +2537,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
if (ABS(temp1_double-temp2_double) > options->delta)
@@ -2375,7 +2552,7 @@ hsize_t diff_datum(void *_mem1,
}
} /* NaN */
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -2405,7 +2582,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -2439,7 +2616,7 @@ hsize_t diff_datum(void *_mem1,
} /* NaN */
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -2469,7 +2646,7 @@ hsize_t diff_datum(void *_mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -2504,7 +2681,7 @@ hsize_t diff_datum(void *_mem1,
} /* NaN */
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -2671,14 +2848,15 @@ hsize_t diff_region(hid_t obj1_id,
*-------------------------------------------------------------------------
*/
if(nblocks1 > 0) {
- alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]);
+ HDassert(ndims1 > 0);
+ alloc_size = (hsize_t)nblocks1 * (unsigned)ndims1 * 2 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- ptdata1 = HDmalloc((size_t)alloc_size);
+ ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1);
- ptdata2 = HDmalloc((size_t)alloc_size);
+ ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2);
@@ -2726,14 +2904,14 @@ hsize_t diff_region(hid_t obj1_id,
*-------------------------------------------------------------------------
*/
if(npoints1 > 0) {
- alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]);
+ alloc_size = (hsize_t)npoints1 * (unsigned)ndims1 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- ptdata1 = HDmalloc((size_t)alloc_size);
+ ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1);
- ptdata2 = HDmalloc((size_t)alloc_size);
+ ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t);
H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2);
@@ -2790,8 +2968,8 @@ hsize_t diff_region(hid_t obj1_id,
HDfree(ptdata2);
}
- nfound_b = nfound_b/ndims1;
- nfound_p = nfound_p/ndims1;
+ nfound_b = nfound_b / (unsigned)ndims1;
+ nfound_p = nfound_p / (unsigned)ndims1;
return (nfound_p + nfound_b);
}
@@ -2807,8 +2985,8 @@ hsize_t diff_region(hid_t obj1_id,
*/
static
-hsize_t character_compare(unsigned char *mem1,
- unsigned char *mem2,
+hsize_t character_compare(char *mem1,
+ char *mem2,
hsize_t i,
unsigned u,
int rank,
@@ -2821,8 +2999,8 @@ hsize_t character_compare(unsigned char *mem1,
int *ph)
{
hsize_t nfound=0; /* differences found */
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
+ char temp1_uchar;
+ char temp2_uchar;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -2857,7 +3035,7 @@ hsize_t character_compare(unsigned char *mem1,
*-------------------------------------------------------------------------
*/
-hsize_t character_compare_opt(unsigned char *mem1,
+static hsize_t character_compare_opt(unsigned char *mem1,
unsigned char *mem2,
hsize_t i,
int rank,
@@ -2873,7 +3051,7 @@ hsize_t character_compare_opt(unsigned char *mem1,
unsigned char temp1_uchar;
unsigned char temp2_uchar;
double per;
- int both_zero;
+ hbool_t both_zero;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -2950,7 +3128,7 @@ hsize_t character_compare_opt(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_float(unsigned char *mem1,
+static hsize_t diff_float(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -2969,9 +3147,9 @@ hsize_t diff_float(unsigned char *mem1,
float temp2_float;
hsize_t i;
double per;
- int both_zero;
- int isnan1=0;
- int isnan2=0;
+ hbool_t both_zero;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
h5difftrace("diff_float start\n");
@@ -2998,27 +3176,27 @@ hsize_t diff_float(unsigned char *mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
- if (ABS(temp1_float-temp2_float) > options->delta)
+ if ((double)ABS(temp1_float-temp2_float) > options->delta)
{
if ( print_data(options) )
{
print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
@@ -3051,7 +3229,7 @@ hsize_t diff_float(unsigned char *mem1,
isnan2 = my_isnan(FLT_FLOAT,&temp2_float);
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( (!isnan1 && !isnan2))
{
PER(temp1_float,temp2_float);
@@ -3062,8 +3240,8 @@ hsize_t diff_float(unsigned char *mem1,
{
print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,
- ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
@@ -3076,21 +3254,21 @@ hsize_t diff_float(unsigned char *mem1,
{
print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_float,temp2_float,
- ABS(temp1_float-temp2_float),
- ABS(1-temp2_float/temp1_float));
+ parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float),
+ (double)ABS(1 - temp2_float / temp1_float));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
@@ -3125,7 +3303,7 @@ hsize_t diff_float(unsigned char *mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_float,temp2_float);
@@ -3136,36 +3314,36 @@ hsize_t diff_float(unsigned char *mem1,
{
print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,
- ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
else
- if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta )
+ if ( per > options->percent && (double)ABS(temp1_float - temp2_float) > options->delta )
{
if ( print_data(options) )
{
print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_float,temp2_float,
- ABS(temp1_float-temp2_float),
- ABS(1-temp2_float/temp1_float));
+ parallel_print(F_FORMAT_P, (double)temp1_float, (double)temp2_float,
+ (double)ABS(temp1_float - temp2_float),
+ (double)ABS(1 - temp2_float / temp1_float));
}
nfound++;
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
@@ -3194,7 +3372,7 @@ hsize_t diff_float(unsigned char *mem1,
{
print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float));
+ parallel_print(F_FORMAT, (double)temp1_float, (double)temp2_float, (double)ABS(temp1_float - temp2_float));
}
nfound++;
}
@@ -3226,7 +3404,7 @@ hsize_t diff_float(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_double(unsigned char *mem1,
+static hsize_t diff_double(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -3245,9 +3423,9 @@ hsize_t diff_double(unsigned char *mem1,
double temp2_double;
hsize_t i;
double per;
- int both_zero;
- int isnan1=0;
- int isnan2=0;
+ hbool_t both_zero;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
h5difftrace("diff_double start\n");
/*-------------------------------------------------------------------------
@@ -3273,7 +3451,7 @@ hsize_t diff_double(unsigned char *mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
if (ABS(temp1_double-temp2_double) > options->delta)
{
@@ -3287,7 +3465,7 @@ hsize_t diff_double(unsigned char *mem1,
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -3326,7 +3504,7 @@ hsize_t diff_double(unsigned char *mem1,
isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -3359,7 +3537,7 @@ hsize_t diff_double(unsigned char *mem1,
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -3400,7 +3578,7 @@ hsize_t diff_double(unsigned char *mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -3434,7 +3612,7 @@ hsize_t diff_double(unsigned char *mem1,
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -3510,7 +3688,7 @@ hsize_t diff_double(unsigned char *mem1,
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
-hsize_t diff_ldouble(unsigned char *mem1,
+static hsize_t diff_ldouble(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -3529,9 +3707,9 @@ hsize_t diff_ldouble(unsigned char *mem1,
long double temp2_double;
hsize_t i;
double per;
- int both_zero;
- int isnan1=0;
- int isnan2=0;
+ hbool_t both_zero;
+ hbool_t isnan1 = FALSE;
+ hbool_t isnan2 = FALSE;
h5difftrace("diff_ldouble start\n");
@@ -3558,7 +3736,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
if (ABS(temp1_double-temp2_double) > options->delta)
{
@@ -3572,7 +3750,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -3611,7 +3789,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -3644,7 +3822,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -3685,7 +3863,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
/* both not NaN, do the comparison */
- if ( isnan1==0 && isnan2==0)
+ if ( !isnan1 && !isnan2)
{
PER(temp1_double,temp2_double);
@@ -3719,7 +3897,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
/* only one is NaN, assume difference */
- else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
{
if ( print_data(options) )
{
@@ -3795,7 +3973,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_schar(unsigned char *mem1,
+static hsize_t diff_schar(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -3814,7 +3992,7 @@ hsize_t diff_schar(unsigned char *mem1,
char temp2_char;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_schar start\n");
@@ -3974,7 +4152,7 @@ hsize_t diff_schar(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_uchar(unsigned char *mem1,
+static hsize_t diff_uchar(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -3993,7 +4171,7 @@ hsize_t diff_uchar(unsigned char *mem1,
unsigned char temp2_uchar;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_uchar start\n");
@@ -4152,7 +4330,7 @@ hsize_t diff_uchar(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_short(unsigned char *mem1,
+static hsize_t diff_short(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -4171,7 +4349,7 @@ hsize_t diff_short(unsigned char *mem1,
short temp2_short;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_short start\n");
/* -d and !-p */
@@ -4332,7 +4510,7 @@ hsize_t diff_short(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_ushort(unsigned char *mem1,
+static hsize_t diff_ushort(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -4351,7 +4529,7 @@ hsize_t diff_ushort(unsigned char *mem1,
unsigned short temp2_ushort;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_ushort start\n");
/* -d and !-p */
@@ -4513,7 +4691,7 @@ hsize_t diff_ushort(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_int(unsigned char *mem1,
+static hsize_t diff_int(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -4532,7 +4710,7 @@ hsize_t diff_int(unsigned char *mem1,
int temp2_int;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_int start\n");
/* -d and !-p */
@@ -4694,7 +4872,7 @@ hsize_t diff_int(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_uint(unsigned char *mem1,
+static hsize_t diff_uint(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -4713,7 +4891,7 @@ hsize_t diff_uint(unsigned char *mem1,
unsigned int temp2_uint;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_uint start\n");
/* -d and !-p */
@@ -4873,7 +5051,7 @@ hsize_t diff_uint(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_long(unsigned char *mem1,
+static hsize_t diff_long(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -4892,7 +5070,7 @@ hsize_t diff_long(unsigned char *mem1,
long temp2_long;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_long start\n");
/* -d and !-p */
@@ -5058,7 +5236,7 @@ hsize_t diff_long(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_ulong(unsigned char *mem1,
+static hsize_t diff_ulong(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -5077,7 +5255,7 @@ hsize_t diff_ulong(unsigned char *mem1,
unsigned long temp2_ulong;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_ulong start\n");
@@ -5243,7 +5421,7 @@ hsize_t diff_ulong(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_llong(unsigned char *mem1,
+static hsize_t diff_llong(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -5262,7 +5440,7 @@ hsize_t diff_llong(unsigned char *mem1,
long long temp2_llong;
hsize_t i;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_llong start\n");
/* -d and !-p */
@@ -5418,7 +5596,7 @@ hsize_t diff_llong(unsigned char *mem1,
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_ullong(unsigned char *mem1,
+static hsize_t diff_ullong(unsigned char *mem1,
unsigned char *mem2,
hsize_t nelmts,
hsize_t hyper_start,
@@ -5438,7 +5616,7 @@ hsize_t diff_ullong(unsigned char *mem1,
hsize_t i;
float f1, f2;
double per;
- int both_zero;
+ hbool_t both_zero;
h5difftrace("diff_ullong start\n");
/* -d and !-p */
@@ -5665,8 +5843,8 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
* detect NaNs
*-------------------------------------------------------------------------
*/
- int isnan1 = my_isnan(FLT_DOUBLE,&value);
- int isnan2 = my_isnan(FLT_DOUBLE,&expected);
+ hbool_t isnan1 = my_isnan(FLT_DOUBLE,&value);
+ hbool_t isnan2 = my_isnan(FLT_DOUBLE,&expected);
/*-------------------------------------------------------------------------
* we consider NaN == NaN to be true
@@ -5720,8 +5898,8 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
* detect NaNs
*-------------------------------------------------------------------------
*/
- int isnan1 = my_isnan(FLT_LDOUBLE,&value);
- int isnan2 = my_isnan(FLT_LDOUBLE,&expected);
+ hbool_t isnan1 = my_isnan(FLT_LDOUBLE,&value);
+ hbool_t isnan2 = my_isnan(FLT_LDOUBLE,&expected);
/*-------------------------------------------------------------------------
* we consider NaN == NaN to be true
@@ -5779,8 +5957,8 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
* detect NaNs
*-------------------------------------------------------------------------
*/
- int isnan1 = my_isnan(FLT_FLOAT,&value);
- int isnan2 = my_isnan(FLT_FLOAT,&expected);
+ hbool_t isnan1 = my_isnan(FLT_FLOAT,&value);
+ hbool_t isnan2 = my_isnan(FLT_FLOAT,&expected);
/*-------------------------------------------------------------------------
* we consider NaN == NaN to be true
@@ -5832,40 +6010,39 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
*
*-------------------------------------------------------------------------
*/
-static int
+static hbool_t
my_isnan(dtype_t type, void *val)
{
- int retval = 0;
+ hbool_t retval = FALSE;
char s[256];
h5difftrace("my_isnan start\n");
if (FLT_FLOAT==type)
{
float x;
+
HDmemcpy(&x, val, sizeof(float));
retval = (x!=x);
-
-
-
}
else if (FLT_DOUBLE==type)
{
double x;
+
HDmemcpy(&x, val, sizeof(double));
retval = (x!=x);
-
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
}
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
else if (FLT_LDOUBLE==type)
{
long double x;
+
HDmemcpy(&x, val, sizeof(long double));
retval = (x!=x);
-#endif
}
+#endif
else
{
- return 0;
+ return FALSE;
}
/*
@@ -5877,44 +6054,39 @@ my_isnan(dtype_t type, void *val)
if (FLT_FLOAT==type)
{
float x;
- HDmemcpy(&x, val, sizeof(float));
- sprintf(s, "%g", x);
-
+ HDmemcpy(&x, val, sizeof(float));
+ HDsnprintf(s, sizeof(s), "%g", (double)x);
}
else if (FLT_DOUBLE==type)
{
double x;
+
HDmemcpy(&x, val, sizeof(double));
- sprintf(s, "%g", x);
-#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
+ HDsnprintf(s, sizeof(s), "%g", x);
}
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
else if (FLT_LDOUBLE==type)
{
long double x;
+
HDmemcpy(&x, val, sizeof(long double));
- sprintf(s, "%Lg", x);
-#endif
+ HDsnprintf(s, sizeof(s), "%Lg", x);
}
+#endif
else
{
- return 0;
+ return FALSE;
}
-
if ( HDstrstr(s, "NaN") ||
HDstrstr(s, "NAN") ||
HDstrstr(s, "nan") ||
HDstrstr(s, "-1.#IND") /* WIN32 */
)
{
-
- retval = 1;
+ retval = TRUE;
}
-
-
-
-
}
#ifdef H5_VMS
@@ -5925,15 +6097,17 @@ my_isnan(dtype_t type, void *val)
if (FLT_FLOAT==type)
{
float x;
+
HDmemcpy(&x, val, sizeof(float));
retval = (x==FLT_MAX || x==-FLT_MAX);
} else if (FLT_DOUBLE==type) {
double x;
+
HDmemcpy(&x, val, sizeof(double));
retval = (x==DBL_MAX || x==-DBL_MAX);
} else
{
- return 0;
+ return FALSE;
}
}
#endif /*H5_VMS*/
@@ -5943,9 +6117,6 @@ my_isnan(dtype_t type, void *val)
}
-
-
-
/*-------------------------------------------------------------------------
*
* Local functions
@@ -6164,8 +6335,8 @@ static void h5diff_print_char(char ch)
*/
static void get_member_types(hid_t tid, mcomp_t *members)
{
- int i;
int tclass;
+ unsigned u;
if (tid <=0 || !members)
return;
@@ -6179,23 +6350,24 @@ static void get_member_types(hid_t tid, mcomp_t *members)
}
else if (tclass == H5T_COMPOUND)
{
- members->n = H5Tget_nmembers( tid );
- if (members->n <=0)
+ int nmembs;
+
+ nmembs = H5Tget_nmembers(tid);
+ if(nmembs <= 0)
return;
+ members->n = (unsigned)nmembs;
- members->ids = HDcalloc(members->n, sizeof(hid_t));
- members->flags = HDcalloc(members->n, sizeof(unsigned char));
- members->offsets = HDcalloc(members->n, sizeof(size_t));
- members->m = HDcalloc(members->n, sizeof(mcomp_t *));
+ members->ids = (hid_t *)HDcalloc(members->n, sizeof(hid_t));
+ members->offsets = (size_t *)HDcalloc(members->n, sizeof(size_t));
+ members->m = (mcomp_t **)HDcalloc(members->n, sizeof(mcomp_t *));
- for (i=0; i< members->n; i++)
+ for(u = 0; u < members->n; u++)
{
- members->ids[i] = H5Tget_member_type( tid, i );
- members->flags[i] = H5Tis_variable_str( members->ids[i] );
- members->offsets[i] = H5Tget_member_offset( tid, i );
- members->m[i] = (mcomp_t *)HDmalloc(sizeof(mcomp_t));
- HDmemset(members->m[i], 0, sizeof(mcomp_t));
- get_member_types(members->ids[i], members->m[i]);
+ members->ids[u] = H5Tget_member_type( tid, u );
+ members->offsets[u] = H5Tget_member_offset( tid, u );
+ members->m[u] = (mcomp_t *)HDmalloc(sizeof(mcomp_t));
+ HDmemset(members->m[u], 0, sizeof(mcomp_t));
+ get_member_types(members->ids[u], members->m[u]);
}
}
@@ -6211,24 +6383,23 @@ static void get_member_types(hid_t tid, mcomp_t *members)
*/
static void close_member_types(mcomp_t *members)
{
- int i;
+ unsigned u;
if (!members || members->n<=0 || !members->ids)
return;
- for (i=0; i<members->n; i++)
+ for(u = 0; u < members->n; u++)
{
- if (members->m[i])
+ if(members->m[u])
{
- close_member_types(members->m[i]);
- HDfree(members->m[i]);
+ close_member_types(members->m[u]);
+ HDfree(members->m[u]);
}
- H5Tclose(members->ids[i]);
+ H5Tclose(members->ids[u]);
}
- HDfree (members->m);
- HDfree (members->ids);
- HDfree (members->flags);
- HDfree (members->offsets);
+ HDfree(members->m);
+ HDfree(members->ids);
+ HDfree(members->offsets);
}
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 4899200..ef1d761 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -108,17 +108,17 @@ static void table_attrs_free( table_attrs_t *table )
*------------------------------------------------------------------------*/
static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *table)
{
- unsigned int new;
+ size_t new_val;
if(table->nattrs == table->size) {
table->size = MAX(1, table->size * 2);
table->attrs = (match_attr_t *)HDrealloc(table->attrs, table->size * sizeof(match_attr_t));
} /* end if */
- new = table->nattrs++;
- table->attrs[new].exist[0] = exist[0];
- table->attrs[new].exist[1] = exist[1];
- table->attrs[new].name = (char *)HDstrdup(name);
+ new_val = table->nattrs++;
+ table->attrs[new_val].exist[0] = exist[0];
+ table->attrs[new_val].exist[1] = exist[1];
+ table->attrs[new_val].name = (char *)HDstrdup(name);
}
/*-------------------------------------------------------------------------
@@ -459,8 +459,8 @@ hsize_t diff_attr(hid_t loc1_id,
goto error;
/* format output string */
- sprintf(np1,"%s of <%s>",name1,path1);
- sprintf(np2,"%s of <%s>",name2,path2);
+ HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);
+ HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2);
/*---------------------------------------------------------------------
* array compare
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index e1f71eb..4b12560 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -2962,11 +2962,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
int ndims = H5Sget_simple_extent_dims(sid, dims, NULL);
/* only print the compression ratio for these filters */
- for(i = 0; i < nfilters; i++) {
+ for(i = 0; i < nfilters && !ok; i++) {
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
-
+ ok = (filtn>=0);
+
+ /* this following code will not show compression ratio for
+ user defined filter. For example, see HDFFV-8344 --xcao@hdfgroup.org
switch(filtn) {
case H5Z_FILTER_DEFLATE:
case H5Z_FILTER_SZIP:
@@ -2975,6 +2978,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
ok = 1;
break;
}
+ */
}
if(ndims && ok) {
@@ -3152,6 +3156,9 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
+
+ if (filtn<0)
+ continue; /* nothing to print for invalid filter */
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
@@ -3245,10 +3252,13 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0);
break;
default:
+ /* filter do not have to be avaiable for showing registered filter info.
+ see HDFFV-8346 for details. --xcao@hdfgroup.org
if(H5Zfilter_avail(filtn))
h5tools_str_append(&buffer, "%s %s", "USER_REGISTERED_FILTER", BEGIN);
else
- h5tools_str_append(&buffer, "%s %s", "UNKNOWN_FILTER", BEGIN);
+ */
+ h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0);
ctx->indent_level++;
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 10c643d..3285278 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -159,7 +159,7 @@ typedef struct {
/* obtain link info from H5tools_get_symlink_info() */
typedef struct {
H5O_type_t trg_type; /* OUT: target type */
- const char *trg_path; /* OUT: target obj path. This must be freed
+ char *trg_path; /* OUT: target obj path. This must be freed
* when used with H5tools_get_symlink_info() */
haddr_t objno; /* OUT: target object address */
unsigned long fileno; /* OUT: File number that target object is located in */
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index 233c80a..f62c66f 100644
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -85,11 +85,12 @@ CLINKERBASE="@CC@"
# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user.
# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS.
-# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts to override
-# them. User's LDFLAGS come just before clibpath, user's LIBS come after
-# $link_objs and before the hdf5 libraries in $link_args, followed by any
-# external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS
-# or LIBS carried in from the hdf5 build.
+# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's
+# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and
+# before the hdf5 libraries in $link_args, followed by any external library
+# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in
+# from the hdf5 build. The order of the flags is intended to give precedence
+# to the user's flags.
H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@"
H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@"
H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
@@ -102,7 +103,17 @@ CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}"
LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}"
LIBS="${HDF5_LIBS:-$LIBSBASE}"
-USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}"
+# If a static library is available, the default will be to use it. If the only
+# available library is shared, it will be used by default. The user can
+# override either default, although choosing an unavailable library will result
+# in link errors.
+STATIC_AVAILABLE="@enable_static@"
+if test "${STATIC_AVAILABLE}" = "yes"; then
+ USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}"
+else
+ USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}"
+fi
+
usage() {
# A wonderfully informative "usage" message.
@@ -121,8 +132,9 @@ usage() {
echo " subdirectories [default: $prefix]"
echo " -show Show the commands without executing them"
echo " -showconfig Show the HDF5 library configuration summary"
- echo " -shlib Compile with shared HDF5 libraries"
- echo " -noshlib Compile with static HDF5 libraries [default]"
+ echo " -shlib Compile with shared HDF5 libraries [default when built with"
+ echo " disable-static]"
+ echo " -noshlib Compile with static HDF5 libraries [default when static available]"
echo " "
echo " <compile line> - the normal compile line options for your compiler."
echo " $prog_name uses the same compiler you used to compile"
@@ -374,11 +386,12 @@ if test "x$do_link" = "xyes"; then
# module. It's okay if they're included twice in the compile line.
link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS"
- # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts to override
- # them. User's LDFLAGS come just before clibpath, user's LIBS come after
- # $link_objs and before the hdf5 libraries in $link_args, followed by any
- # external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS
- # or LIBS carried in from the hdf5 build.
+ # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's
+ # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and
+ # before the hdf5 libraries in $link_args, followed by any external library
+ # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in
+ # from the hdf5 build. The order of the flags is intended to give precedence
+ # to the user's flags.
$SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link
status=$?
fi
diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c
index b4ac6f6..b9fb588 100644
--- a/tools/misc/h5mkgrp.c
+++ b/tools/misc/h5mkgrp.c
@@ -46,6 +46,7 @@ typedef struct {
size_t ngroups; /* Number of groups to create */
char **groups; /* Pointer to array of group names */
} param_t;
+param_t params; /* Command line parameter settings */
/*-------------------------------------------------------------------------
@@ -62,6 +63,15 @@ typedef struct {
static void
leave(int ret)
{
+ int curr_group;
+
+ if (params.fname)
+ HDfree (params.fname);
+ if (params.ngroups) {
+ for(curr_group = 0; curr_group < params.ngroups; curr_group++)
+ HDfree (params.groups[curr_group]);
+ HDfree (params.groups);
+ }
h5tools_close();
HDexit(ret);
} /* end leave() */
@@ -206,7 +216,6 @@ for(curr_group = 0; curr_group < params->ngroups; curr_group++)
int
main(int argc, const char *argv[])
{
- param_t params; /* Command line parameter settings */
hid_t fid; /* HDF5 file ID */
hid_t fapl_id; /* File access property list ID */
hid_t lcpl_id; /* Link creation property list ID */
@@ -322,6 +331,6 @@ main(int argc, const char *argv[])
/* Shut down h5tools lib */
h5tools_close();
- return EXIT_SUCCESS;
+ leave(EXIT_SUCCESS);
} /* end main() */
diff --git a/tools/misc/h5perf_gentest.c b/tools/misc/h5perf_gentest.c
index 6a080d0..6a080d0 100755..100644
--- a/tools/misc/h5perf_gentest.c
+++ b/tools/misc/h5perf_gentest.c
diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in
index ae79b70..6b6ef87 100644
--- a/tools/misc/h5redeploy.in
+++ b/tools/misc/h5redeploy.in
@@ -14,9 +14,10 @@
# access to either file, you may request a copy from help@hdfgroup.org.
#
-## Update HDF5 compiler tools after the HDF5 software has been installed
-## in a new location.
-## For help page, use "h5redeploy -help"
+## Update HDF5 compiler tools after the HDF5 software has been installed ##
+## in a new location. ##
+## For help page, use "h5redeploy -help" ##
+## ##
# Constants definitions
EXIT_SUCCESS=0
@@ -29,14 +30,20 @@ usage() {
# A wonderfully informative "usage" message.
echo "usage: $prog_name [OPTIONS]"
echo " OPTIONS:"
- echo " -help|help This help message"
- echo " -echo Show all the shell commands executed"
- echo " -force No prompt, just do it"
- echo " -prefix=DIR New directory to find HDF5 lib/ and include/"
- echo " subdirectories [default: current directory]"
- echo " -tool=TOOL Tool to update. TOOL must be in the current"
- echo " directory and writable. [default: $h5tools]"
- echo " -show Show the commands without executing them"
+ echo " -help|help This help message"
+ echo " -echo Show all the shell commands executed"
+ echo " -force No prompt, just do it"
+ echo " -prefix=DIR New directory to find HDF5 lib/ and include/"
+ echo " subdirectories [default: current directory]"
+ echo " -exec-prefix=DIR New directory to find HDF5 lib/"
+ echo " subdirectory [default: <prefix>]"
+ echo " -libdir=DIR New directory for the HDF5 lib directory"
+ echo " [default: <exec-prefix>/lib]"
+ echo " -includedir=DIR New directory for the HDF5 header files"
+ echo " [default: <prefix>/include]"
+ echo " -tool=TOOL Tool to update. TOOL must be in the current"
+ echo " directory and writable. [default: $h5tools]"
+ echo " -show Show the commands without executing them"
echo " "
exit $EXIT_FAILURE
}
@@ -70,17 +77,38 @@ ERROR()
# Main
#
+############################################################################
+## Installation directories: ##
+## prefix architecture-independent files. ##
+## exec_prefix architecture-dependent files, default is <prefix>. ##
+## libdir libraries, default is <exec_prefix>/lib. ##
+## includedir header files, default is <prefix/include>. ##
+## Not used here: ##
+## bindir executables, <exec_prefix/bin>. ##
+############################################################################
# Initialization
h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools
foundtools= # tools found and will be modified
fmode= # force mode, default is off
-prefix=`(cd ..;pwd)`
+prefix=
+exec_prefix=
+libdir=
+includedir=
# Parse options
for arg in $@ ; do
case "$arg" in
-prefix=*)
- prefix="`expr "$arg" : '-prefix=\(.*\)'`"
+ prefix="`echo $arg | cut -f2 -d=`"
+ ;;
+ -exec-prefix=*)
+ exec_prefix="`echo $arg | cut -f2 -d=`"
+ ;;
+ -libdir=*)
+ libdir="`echo $arg | cut -f2 -d=`"
+ ;;
+ -includedir=*)
+ includedir="`echo $arg | cut -f2 -d=`"
;;
-echo)
set -x
@@ -89,7 +117,7 @@ for arg in $@ ; do
SHOW="echo"
;;
-tool=*)
- h5tools="`expr "$arg" : '-tool=\(.*\)'`"
+ h5tools="`echo $arg | cut -f2 -d=`"
;;
-help|help)
usage
@@ -105,10 +133,18 @@ for arg in $@ ; do
esac
done
-# Sanity checks
-if [ ! -d $prefix ]; then
- ERROR "prefix($prefix) is not an existing directory"
- exit $EXIT_FAILURE
+# Set to default value, one above where i am, if not given by user
+if [ -z "$prefix" ]; then
+ prefix=`(cd ..;pwd)`
+fi
+if [ -z "$exec_prefix" ]; then
+ exec_prefix='${prefix}' # use single quotes to prevent expansion of $
+fi
+if [ -z "$libdir" ]; then
+ libdir='${exec_prefix}'/lib # use single quotes to prevent expansion of $
+fi
+if [ -z "$includedir" ]; then
+ includedir='${prefix}'/include # use single quotes to prevent expansion of $
fi
for x in $h5tools; do
@@ -144,10 +180,19 @@ fi
CMDFILE=/tmp/h5redeploy.$$
touch $CMDFILE
chmod 0600 $CMDFILE
-echo "/^prefix/c" >> $CMDFILE
-echo prefix=\""$prefix"\" >> $CMDFILE
-echo . >> $CMDFILE
-(echo w; echo q) >> $CMDFILE
+echo "/^prefix=/c" >> $CMDFILE
+echo prefix=\""$prefix"\" >> $CMDFILE
+echo . >> $CMDFILE
+echo "/^exec_prefix=/c" >> $CMDFILE
+echo exec_prefix=\""$exec_prefix"\" >> $CMDFILE
+echo . >> $CMDFILE
+echo "/^libdir=/c" >> $CMDFILE
+echo libdir=\""$libdir"\" >> $CMDFILE
+echo . >> $CMDFILE
+echo "/^includedir=/c" >> $CMDFILE
+echo includedir=\""$includedir"\" >> $CMDFILE
+echo . >> $CMDFILE
+(echo w; echo q) >> $CMDFILE
# Update them
@@ -171,10 +216,3 @@ done
# Cleanup
rm -f $CMDFILE
exit $EXIT_SUCCESS
-
-# Some possible future features to add
-# CCBASE - Name of the alternative C compiler
-# CLINKERBASE - Name of the alternative linker
-# LDFLAGS - Path to different libraries your application will link with
-# (this path should include the path to the zlib library)
-# LIBS - Libraries your application will link with
diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl
index 072ef23..c341ded 100644
--- a/tools/testfiles/tfletcher32.ddl
+++ b/tools/testfiles/tfletcher32.ddl
@@ -4,7 +4,7 @@ DATASET "fletcher32" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 816
+ SIZE 816 (0.980:1 COMPRESSION)
}
FILTERS {
CHECKSUM FLETCHER32
diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl
index cd1b5f8..5c183fe 100644
--- a/tools/testfiles/tshuffle.ddl
+++ b/tools/testfiles/tshuffle.ddl
@@ -4,7 +4,7 @@ DATASET "shuffle" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 800
+ SIZE 800 (1.000:1 COMPRESSION)
}
FILTERS {
PREPROCESSING SHUFFLE
diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl
index 07b478f..24745b9 100644
--- a/tools/testfiles/tuserfilter.ddl
+++ b/tools/testfiles/tuserfilter.ddl
@@ -4,10 +4,10 @@ DATASET "myfilter" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 800
+ SIZE 800 (1.000:1 COMPRESSION)
}
FILTERS {
- UNKNOWN_FILTER {
+ USER_DEFINED_FILTER {
FILTER_ID 405
COMMENT myfilter
PARAMS { 5 6 }