From 9729a518b49a2217307c3c7ce9b33b064fc83147 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 18 Oct 2013 15:03:47 -0500 Subject: [svn-r24332] Bring revision #24330 from revise_chunks. h5committested. --- MANIFEST | 37 +- config/cmake/ConfigureChecks.cmake | 8 + config/cmake/H5pubconf.h.in | 3 + config/gnu-flags | 3 +- configure | 39 +- configure.ac | 24 +- fortran/src/H5Pf.c | 26 +- fortran/test/fortranlib_test_1_8.f90 | 10 + release_docs/INSTALL_Cygwin.txt | 23 +- release_docs/RELEASE.txt | 7 +- src/H5PL.c | 4 +- src/H5Pint.c | 26 +- src/H5T.c | 13 +- src/H5Tconv.c | 56 +- src/H5Zscaleoffset.c | 52 +- src/H5config.h.in | 3 + src/H5private.h | 19 + src/Makefile.am | 2 +- src/Makefile.in | 2 +- test/dsets.c | 10 +- test/dtypes.c | 62 +- tools/h5dump/h5dump_ddl.c | 100 +- tools/h5dump/h5dump_defines.h | 2 +- tools/h5dump/h5dump_xml.c | 844 ++--- tools/h5dump/h5dumpgentest.c | 12 +- tools/h5dump/testh5dump.sh.in | 36 +- tools/h5jam/h5jam.c | 17 +- tools/h5repack/CMakeLists.txt | 35 + tools/h5repack/CMakeTests.cmake | 116 +- tools/h5repack/Makefile.am | 18 +- tools/h5repack/Makefile.in | 155 +- tools/h5repack/h5repack.c | 1822 ++++++----- tools/h5repack/h5repack.sh.in | 48 +- tools/h5repack/h5repack_copy.c | 3239 ++++++++++---------- tools/h5repack/h5repack_filters.c | 17 +- tools/h5repack/h5repack_main.c | 1088 +++---- tools/h5repack/h5repack_opttable.c | 530 ++-- tools/h5repack/h5repack_parse.c | 859 +++--- tools/h5repack/h5repack_plugin.sh.in | 238 ++ tools/h5repack/h5repack_verify.c | 15 +- .../testfiles/deflate_limit.h5repack_layout.h5.ddl | 130 + tools/h5repack/testfiles/h5repack-help.txt | 122 + tools/h5repack/testfiles/h5repack_filters.h5.tst | 13 + .../testfiles/h5repack_layout.h5-plugin_test.ddl | 158 + tools/h5repack/testfiles/h5repack_layout.h5.ddl | 660 +++- .../testfiles/plugin_test.h5repack_layout.h5.tst | 14 + tools/lib/h5diff_array.c | 17 +- tools/lib/h5tools.c | 28 +- tools/lib/h5tools_dump.c | 198 +- tools/testfiles/h5repack_filters.h5.ddl | 13 - 50 files changed, 6280 insertions(+), 4693 deletions(-) create mode 100644 tools/h5repack/h5repack_plugin.sh.in create mode 100644 tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl create mode 100644 tools/h5repack/testfiles/h5repack-help.txt create mode 100644 tools/h5repack/testfiles/h5repack_filters.h5.tst create mode 100644 tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl create mode 100644 tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst delete mode 100644 tools/testfiles/h5repack_filters.h5.ddl diff --git a/MANIFEST b/MANIFEST index 415d295..e4c9963 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1292,6 +1292,7 @@ ./tools/h5repack/Makefile.am ./tools/h5repack/Makefile.in ./tools/h5repack/h5repack.sh.in +./tools/h5repack/h5repack_plugin.sh.in ./tools/h5repack/h5repack.c ./tools/h5repack/h5repack.h ./tools/h5repack/h5repack_copy.c @@ -1788,7 +1789,6 @@ ./tools/testfiles/tfpformat.h5 # h5dump h5repack validation -./tools/testfiles/h5repack_filters.h5.ddl ./tools/testfiles/zerodim.ddl ./tools/testfiles/zerodim.h5 @@ -2162,30 +2162,35 @@ ./tools/h5diff/testfiles/non_comparables2.h5 #test files for h5repack -./tools/h5repack/testfiles/h5repack_fill.h5 -./tools/h5repack/testfiles/h5repack_objs.h5 ./tools/h5repack/testfiles/h5repack_attr.h5 +./tools/h5repack/testfiles/h5repack_attr_refs.h5 +./tools/h5repack/testfiles/h5repack_deflate.h5 +./tools/h5repack/testfiles/h5repack_early.h5 +./tools/h5repack/testfiles/h5repack_ext.bin +./tools/h5repack/testfiles/h5repack_ext.h5 +./tools/h5repack/testfiles/h5repack_fill.h5 +./tools/h5repack/testfiles/h5repack_filters.h5 +./tools/h5repack/testfiles/h5repack_fletcher.h5 ./tools/h5repack/testfiles/h5repack_hlink.h5 +./tools/h5repack/testfiles/h5repack.info ./tools/h5repack/testfiles/h5repack_layout.h5 -./tools/h5repack/testfiles/h5repack_layout.h5.ddl ./tools/h5repack/testfiles/h5repack_layouto.h5 ./tools/h5repack/testfiles/h5repack_layout2.h5 ./tools/h5repack/testfiles/h5repack_layout3.h5 -./tools/h5repack/testfiles/h5repack_early.h5 -./tools/h5repack/testfiles/h5repack_szip.h5 -./tools/h5repack/testfiles/h5repack_deflate.h5 -./tools/h5repack/testfiles/h5repack_shuffle.h5 -./tools/h5repack/testfiles/h5repack_fletcher.h5 -./tools/h5repack/testfiles/h5repack_filters.h5 +./tools/h5repack/testfiles/h5repack_named_dtypes.h5 ./tools/h5repack/testfiles/h5repack_nbit.h5 +./tools/h5repack/testfiles/h5repack_objs.h5 +./tools/h5repack/testfiles/h5repack_refs.h5 +./tools/h5repack/testfiles/h5repack_shuffle.h5 ./tools/h5repack/testfiles/h5repack_soffset.h5 -./tools/h5repack/testfiles/h5repack.info -./tools/h5repack/testfiles/h5repack_ext.bin -./tools/h5repack/testfiles/h5repack_ext.h5 +./tools/h5repack/testfiles/h5repack_szip.h5 ./tools/h5repack/testfiles/ublock.bin -./tools/h5repack/testfiles/h5repack_named_dtypes.h5 -./tools/h5repack/testfiles/h5repack_refs.h5 -./tools/h5repack/testfiles/h5repack_attr_refs.h5 +./tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +./tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst +./tools/h5repack/testfiles/h5repack-help.txt +./tools/h5repack/testfiles/h5repack_filters.h5.tst +./tools/h5repack/testfiles/h5repack_layout.h5.ddl +./tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl # jam utility and tests ./tools/h5jam/h5jam.c diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index b467a15..e495d9b 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -152,6 +152,14 @@ ENDIF (WIN32) # SET (H5_DEFAULT_VFD H5FD_SEC2) +IF (NOT DEFINED "H5_DEFAULT_PLUGIN") + IF (WINDOWS) + SET (H5_DEFAULT_PLUGIN "%ALLUSERSPROFILE%/hdf5/lib/plugin") + ELSE (WINDOWS) + SET (H5_DEFAULT_PLUGIN "/usr/local/hdf5/lib/plugin") + ENDIF (WINDOWS) +ENDIF (NOT DEFINED "H5_DEFAULT_PLUGIN") + IF (WINDOWS) SET (H5_HAVE_WINDOWS 1) # ---------------------------------------------------------------------- diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 2736daf..2160ee8 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -54,6 +54,9 @@ problem converting from unsigned long long to long double */ #cmakedefine H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM @H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM@ +/* Define the default plugins path to compile */ +#cmakedefine H5_DEFAULT_PLUGIN "@H5_DEFAULT_PLUGIN@" + /* Define the default virtual file driver to compile */ #cmakedefine H5_DEFAULT_VFD @H5_DEFAULT_VFD@ diff --git a/config/gnu-flags b/config/gnu-flags index eef38ad..57fc23a 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -220,8 +220,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wformat=2" # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - #H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" + H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CFLAGS="$H5_CFLAGS -Wendif-labels" diff --git a/configure b/configure index e3790f4..83e06fe 100755 --- a/configure +++ b/configure @@ -921,6 +921,7 @@ with_mpe enable_mpi_size enable_filters with_default_vfd +with_default_plugin enable_direct_vfd enable_dconv_exception enable_dconv_accuracy @@ -1667,6 +1668,9 @@ Optional Packages: --with-mpe=DIR Use MPE instrumentation [default=no] --with-default-vfd=driver Specify default file driver [default=sec2] + --with-default-plugin=location + Specify default location for plugins + [default="/usr/local/hdf5/lib/plugin"] --with-default-api-version=(v16|v18|v110) Specify default release version of public symbols [default=v110] @@ -23359,7 +23363,7 @@ case "$host_cpu-$host_vendor-$host_os" in ;; esac -## Need to add the AM_ and H5_ into CPFLAGS/CPPFLAGS to make them visible +## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible ## for configure checks. ## Note: Both will be restored by the end of configure. CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" @@ -29271,6 +29275,36 @@ _ACEOF fi ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Custom Plugin Default Path definition" >&5 +$as_echo_n "checking for Custom Plugin Default Path definition... " >&6; } + +# Check whether --with-default-plugin was given. +if test "${with_default_plugin+set}" = set; then : + withval=$with_default_plugin; +else + withval="/usr/local/hdf5/lib/plugin" +fi + + +if test "X$withval" = "X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5 +$as_echo "default" >&6; } + default_plugin="/usr/local/hdf5/lib/plugin" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 +$as_echo "$withval" >&6; } + default_plugin=$withval +fi + + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_PLUGIN "$default_plugin" +_ACEOF + + +## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -33149,7 +33183,7 @@ else fi -ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/testflushrefresh.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh test/test_plugin.sh test/test_usecases.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumppbits.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5import/h5importtestutil.sh tools/h5diff/Makefile tools/h5diff/testh5diff.sh tools/h5diff/testph5diff.sh tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5mkgrp.sh tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/test/test_ld.sh hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/tools/h5watch/Makefile hl/tools/h5watch/testh5watch.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" +ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/testflushrefresh.sh test/H5srcdir_str.h test/testlibinfo.sh test/testlinks_env.sh test/test_plugin.sh test/test_usecases.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumppbits.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5import/h5importtestutil.sh tools/h5diff/Makefile tools/h5diff/testh5diff.sh tools/h5diff/testph5diff.sh tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5repack/h5repack_plugin.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5mkgrp.sh tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/test/test_ld.sh hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/tools/h5watch/Makefile hl/tools/h5watch/testh5watch.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh" cat >confcache <<\_ACEOF @@ -34436,6 +34470,7 @@ do "tools/h5jam/testh5jam.sh") CONFIG_FILES="$CONFIG_FILES tools/h5jam/testh5jam.sh" ;; "tools/h5repack/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5repack/Makefile" ;; "tools/h5repack/h5repack.sh") CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack.sh" ;; + "tools/h5repack/h5repack_plugin.sh") CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack_plugin.sh" ;; "tools/h5ls/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5ls/Makefile" ;; "tools/h5copy/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5copy/Makefile" ;; "tools/h5copy/testh5copy.sh") CONFIG_FILES="$CONFIG_FILES tools/h5copy/testh5copy.sh" ;; diff --git a/configure.ac b/configure.ac index 6c1a0a8..d2623d4 100644 --- a/configure.ac +++ b/configure.ac @@ -1467,7 +1467,7 @@ case "$host_cpu-$host_vendor-$host_os" in ;; esac -## Need to add the AM_ and H5_ into CPFLAGS/CPPFLAGS to make them visible +## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible ## for configure checks. ## Note: Both will be restored by the end of configure. CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" @@ -3052,6 +3052,27 @@ if test "X$default_vfd" = "Xyes"; then fi ## ---------------------------------------------------------------------- +## Enable custom plugin default path for library. It requires SHARED support. +## +AC_MSG_CHECKING([for Custom Plugin Default Path definition]) +AC_ARG_WITH([default-plugin], + [AS_HELP_STRING([--with-default-plugin=location], + [Specify default location for plugins + [default="/usr/local/hdf5/lib/plugin"]])],, + withval="/usr/local/hdf5/lib/plugin") + +if test "X$withval" = "X"; then + AC_MSG_RESULT([default]) + default_plugin="/usr/local/hdf5/lib/plugin" +else + AC_MSG_RESULT([$withval]) + default_plugin=$withval +fi + +AC_DEFINE_UNQUOTED([DEFAULT_PLUGIN], ["$default_plugin"], + [Define the default plugins path to compile]) + +## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## @@ -4518,6 +4539,7 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh + tools/h5repack/h5repack_plugin.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/h5copy/testh5copy.sh diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index dba2aa4..262ce55 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -3370,14 +3370,15 @@ nh5pclose_class_c(hid_t_f *cls) ret_value = 0; return ret_value; } + /****if* H5Pf/h5pget_class_name_c * NAME * h5pget_class_name_c * PURPOSE * Call H5Pget_class_name to get property class name * INPUTS - * cls - identifier of property class - * name - ibuffer to retrieve name in + * cls - identifier of property class + * name - buffer to retrieve name in * name_len - length of the "name" buffer * RETURNS * 0 on success, -1 on failure @@ -3393,30 +3394,25 @@ nh5pget_class_name_c(hid_t_f *cls, _fcd name, int_f *name_len) /******/ { int_f ret_value = -1; - char *c_name = NULL; /* Buffer to hold C string */ - size_t c_size; - c_size = (size_t)*name_len + 1; - - /* - * Allocate buffer to hold name - */ - if(NULL == (c_name = (char *)HDmalloc(c_size))) - goto DONE; + /* Buffer to return name by C function */ + char *c_name; /* - * Call H5Pget_class_name function. + * Call H5Pget_class_name function. c_name is allocated by the library, + * has to be freed by application. */ - c_name = H5Pget_class_name((hid_t)*cls); - if(c_name == NULL) goto DONE; + if(NULL == (c_name = H5Pget_class_name((hid_t)*cls))) + goto DONE; HD5packFstring(c_name, _fcdtocp(name), (size_t)*name_len); ret_value = (int_f)HDstrlen(c_name); + HDfree(c_name); DONE: - HDfree(c_name); return ret_value; } + /****if* H5Pf/h5psetc_c * NAME * h5psetc_c diff --git a/fortran/test/fortranlib_test_1_8.f90 b/fortran/test/fortranlib_test_1_8.f90 index d3ced72..dc45560 100644 --- a/fortran/test/fortranlib_test_1_8.f90 +++ b/fortran/test/fortranlib_test_1_8.f90 @@ -196,6 +196,16 @@ SUBROUTINE test_genprop_basic_class(cleanup, total_error) INTEGER :: size LOGICAL :: flag + !/* Output message about test being performed */ + + !WRITE(*,*) "Testing Basic Generic Property List Class Creation Functionality" + + ! Try some bogus value for class identifier; function should fail gracefully + + cid1 = 456 + CALL H5Pget_class_name_f(cid1, name, size, error) + CALL VERIFY("H5Pget_class_name", error, -1, error) + ! /* Create a new generic class, derived from the root of the class hierarchy */ CALL H5Pcreate_class_f(H5P_ROOT_F, CLASS1_NAME, cid1, error) CALL check("H5Pcreate_class", error, total_error) diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt index 5406820..d78cd85 100644 --- a/release_docs/INSTALL_Cygwin.txt +++ b/release_docs/INSTALL_Cygwin.txt @@ -5,7 +5,7 @@ Preconditions: -------------- -1. Installed Cygwin 1.7.5 or higher +1. Installed Cygwin 1.7.15 or higher To install the Cygwin net release, go to http://www.cygwin.com and click on "Install or update now!" icon. This will download a GUI @@ -19,13 +19,13 @@ Preconditions: Cygwin packages. To build HDF5 on Cygwin, Devel package (including gcc,gcc-g++, - gcc-g77, and gcc-java compiles, and gdb tool) should be installed. + gcc-gfortran, and gcc-java compiles, and gdb tool) should be installed. 2. Compilers Installed 2.1 C/C++ Compilers HDF5-1.8 Supported - gcc (4.3.4), which includes: + gcc (4.5.3), which includes: gcc4-core : C compiler gcc4-g++ : C++ compiler gcc4-fortran : fortran compiler @@ -51,7 +51,7 @@ Preconditions: 3.1 Zlib - zlib-1.2.2 or later is supported and tested on Cygwin. + zlib-1.2.5 or later is supported and tested on Cygwin. 3.2 Szip The HDF5 library has a predefined compression filter that uses @@ -61,8 +61,8 @@ Preconditions: http://hdfgroup.org/HDF5/doc_resource/SZIP/index.html. The latest supported public release of SZIP is available from - ftp://ftp.hdfgroup.org/lib-external/szip/2.0. Binary distribution can be - found under ftp://ftp.hdfgroup.org/lib-external/szip/2.0/bin/cygwin + ftp://ftp.hdfgroup.org/lib-external/szip/2.1. Binary distribution can be + found under ftp://ftp.hdfgroup.org/lib-external/szip/2.1/bin/cygwin Install HDF5 on Cygwin @@ -76,19 +76,19 @@ Install HDF5 on Cygwin The HDF5 source code is distributed in a variety of formats which can be unpacked with the following commands, each of which creates - an `hdf5-1.8.5' directory. + an `hdf5-1.8.x' directory. 2.1 Non-compressed tar archive (*.tar) - $ tar xf hdf5-1.8.5.tar + $ tar xf hdf5-1.8.x.tar 2.2 Gzip'd tar archive (*.tar.gz) - $ gunzip < hdf5-1.8.5.tar.gz | tar xf - + $ gunzip < hdf5-1.8.x.tar.gz | tar xf - 2.3 Bzip'd tar archive (*.tar.bz2) - $ bunzip2 < hdf5-1.8.5.tar.bz2 | tar xf - + $ bunzip2 < hdf5-1.8.x.tar.bz2 | tar xf - 2. Setup Environment @@ -233,7 +233,8 @@ Install HDF5 on Cygwin 8. Known Problems - Shared libraries can not be built on Cygwin In release 1.8. + dt_arith tests may fail due to the use of fork. This is a known issue + with cygwin on windows. ----------------------------------------------------------------------- diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index e3e92b6..b844ac5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -40,7 +40,11 @@ New Features Configuration: ------------- - - CMake minimum is now 2.8.10. (ADB 2013/1/14) + - New configuration option added to change the default plugin path. + configure option is --with-default-plugin=location + cmake option is -DH5_DEFAULT_PLUGIN:PATH=location + HDFFV-8513. (ADB 2013/09/04) + - CMake minimum is now 2.8.10. (ADB 2013/01/14) - A new tool, cmakehdf5, which is a build command script similar to buildhdf5 is added and is available in the bin directory. (AKC - 2012/12/12) @@ -278,6 +282,7 @@ New Features Tools: ------ + - h5repack: Added ability to use plugin filters. HDFFV-8345 (ADB - 2013/09/04). - h5dump: Added option -N --any_path, which searches the file for paths that match the search path. HDFFV-7989 (ADB - 2013/08/12). - h5dump: Added optional arg 0 to -A, which excludes attributes from display. diff --git a/src/H5PL.c b/src/H5PL.c index def41d1..1c4b355 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -43,7 +43,6 @@ /* Windows support */ #ifdef H5_HAVE_WIN32_API -#define H5PL_DEFAULT_PATH "%ALLUSERSPROFILE%/hdf5/lib/plugin" #define H5PL_PATH_SEPARATOR ";" /* Handle for dynamic library */ @@ -66,7 +65,6 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); /* Unix support */ #else /* H5_HAVE_WIN32_API */ -#define H5PL_DEFAULT_PATH "/usr/local/hdf5/lib/plugin" #define H5PL_PATH_SEPARATOR ":" /* Handle for dynamic library */ @@ -87,6 +85,8 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ +#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGIN + /* Special symbol to indicate no plugin loading */ #define H5PL_NO_PLUGIN "::" diff --git a/src/H5Pint.c b/src/H5Pint.c index 13cc3c1..40d0a9c 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -4787,9 +4787,6 @@ done: char * H5P_get_class_path(H5P_genclass_t *pclass) { - char *par_path; /* Parent class's full path */ - size_t par_path_len;/* Parent class's full path's length */ - size_t my_path_len; /* This class's name's length */ char *ret_value; /* return value */ FUNC_ENTER_NOAPI_NOINIT @@ -4797,33 +4794,32 @@ H5P_get_class_path(H5P_genclass_t *pclass) HDassert(pclass); /* Recursively build the full path */ - if(pclass->parent!=NULL) { + if(pclass->parent != NULL) { + char *par_path; /* Parent class's full path */ + /* Get the parent class's path */ - par_path=H5P_get_class_path(pclass->parent); - if(par_path!=NULL) { - /* Get the string lengths we need to allocate space */ - par_path_len=HDstrlen(par_path); - my_path_len=HDstrlen(pclass->name); + par_path = H5P_get_class_path(pclass->parent); + if(par_path != NULL) { + size_t ret_str_len; /* Allocate enough space for the parent class's path, plus the '/' * separator, this class's name and the string terminator */ - if(NULL == (ret_value = (char *)H5MM_malloc(par_path_len + 1 + my_path_len + 1))) + ret_str_len = HDstrlen(par_path) + 1 + HDstrlen(pclass->name) + 1; + if(NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") /* Build the full path for this class */ - HDstrcpy(ret_value,par_path); - HDstrcat(ret_value,"/"); - HDstrcat(ret_value,pclass->name); + HDsnprintf(ret_value, ret_str_len, "%s/%s", par_path, pclass->name); /* Free the parent class's path */ H5MM_xfree(par_path); } /* end if */ else - ret_value=H5MM_xstrdup(pclass->name); + ret_value = H5MM_xstrdup(pclass->name); } /* end if */ else - ret_value=H5MM_xstrdup(pclass->name); + ret_value = H5MM_xstrdup(pclass->name); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5T.c b/src/H5T.c index 27c9200..12b7801 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -494,10 +494,10 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0; /* Useful floating-point values for conversion routines */ /* (+/- Inf for all floating-point types) */ -float H5T_NATIVE_FLOAT_POS_INF_g = 0.0; -float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0; -double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0; -double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0; +float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f; +float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f; +double H5T_NATIVE_DOUBLE_POS_INF_g = (double)0.0f; +double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f; /* Declare the free list for H5T_t's and H5T_shared_t's */ H5FL_DEFINE(H5T_t); @@ -2395,7 +2395,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if(NULL == (new_path = H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDstrncpy(new_path->name, name, (size_t)H5T_NAMELEN); - new_path->name[H5T_NAMELEN-1] = '\0'; + new_path->name[H5T_NAMELEN - 1] = '\0'; if(NULL == (new_path->src = H5T_copy(old_path->src, H5T_COPY_ALL)) || NULL == (new_path->dst=H5T_copy(old_path->dst, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data types") @@ -4515,7 +4515,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5E_clear_stack(H5E_DEFAULT); /*ignore the error*/ } /* end if */ else { - HDstrcpy(path->name, H5T_g.soft[i].name); + HDstrncpy(path->name, H5T_g.soft[i].name, (size_t)H5T_NAMELEN); + path->name[H5T_NAMELEN - 1] = '\0'; path->func = H5T_g.soft[i].func; path->is_hard = FALSE; } /* end else */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 9ff0f00..bf686b8 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -8039,7 +8039,9 @@ H5T__conv_float_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8064,7 +8066,9 @@ H5T__conv_float_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8089,7 +8093,9 @@ H5T__conv_double_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8114,7 +8120,9 @@ H5T__conv_double_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX); +GCC_DIAG_ON(float-equal) } @@ -8140,7 +8148,9 @@ H5T__conv_ldouble_schar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8167,7 +8177,9 @@ H5T__conv_ldouble_uchar (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8193,7 +8205,9 @@ H5T__conv_float_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8218,7 +8232,9 @@ H5T__conv_float_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8243,7 +8259,9 @@ H5T__conv_double_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8268,7 +8286,9 @@ H5T__conv_double_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8294,7 +8314,9 @@ H5T__conv_ldouble_short (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/ @@ -8321,7 +8343,9 @@ H5T__conv_ldouble_ushort (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8347,7 +8371,9 @@ H5T__conv_float_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8372,7 +8398,9 @@ H5T__conv_float_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8397,7 +8425,9 @@ H5T__conv_double_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8422,7 +8452,9 @@ H5T__conv_double_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX); +GCC_DIAG_ON(float-equal) } @@ -8448,7 +8480,9 @@ H5T__conv_ldouble_int (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8475,7 +8509,9 @@ H5T__conv_ldouble_uint (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_UINT */ @@ -8501,7 +8537,9 @@ H5T__conv_float_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8526,7 +8564,9 @@ H5T__conv_float_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8551,7 +8591,9 @@ H5T__conv_double_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8576,7 +8618,9 @@ H5T__conv_double_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX); +GCC_DIAG_ON(float-equal) } @@ -8602,7 +8646,9 @@ H5T__conv_ldouble_long (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_INTEGER*/ @@ -8629,7 +8675,9 @@ H5T__conv_ldouble_ulong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_LDOUBLE_INTEGER */ @@ -8656,7 +8704,9 @@ H5T__conv_float_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /* H5T_CONV_INTERNAL_FP_LLONG */ @@ -8710,7 +8760,9 @@ H5T__conv_double_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_FP_LLONG*/ @@ -8764,7 +8816,9 @@ H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t UNUSED dxpl_id) { +GCC_DIAG_OFF(float-equal) H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX); +GCC_DIAG_ON(float-equal) } #endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/ @@ -8909,7 +8963,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Allocate enough space for the buffer holding temporary * converted value */ - buf_size = (size_t)HDpow((double)2.0, (double)src.u.f.esize) / 8 + 1; + buf_size = (size_t)HDpow((double)2.0f, (double)src.u.f.esize) / 8 + 1; int_buf = (uint8_t*)H5MM_calloc(buf_size); /* Get the plist structure. Do I need to close it? */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 0aaff11..83864b9 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -347,10 +347,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Find maximum and minimum values of a buffer with fill value defined for floating-point type */ #define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ { \ - i = 0; while(i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) i++; \ + i = 0; while(i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) i++; \ if(i < d_nelmts) min = max = buf[i]; \ for(; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ continue; /* ignore fill value */ \ if(buf[i] > max) max = buf[i]; \ if(buf[i] < min) min = buf[i]; \ @@ -394,18 +394,18 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ { \ if(sizeof(type)==sizeof(int)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(int)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(int)*8 - 1))) { \ *minbits = sizeof(int)*8; goto done; \ } \ } else if(sizeof(type)==sizeof(long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(long)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(long)*8 - 1))) { \ *minbits = sizeof(long)*8; goto done; \ } \ } else if(sizeof(type)==sizeof(long long)) { \ - if(H5Z_scaleoffset_rnd(max*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)) \ - > HDpow(2.0, (double)(sizeof(long long)*8 - 1))) { \ + if(H5Z_scaleoffset_rnd(max*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)) \ + > HDpow(2.0f, (double)(sizeof(long long)*8 - 1))) { \ *minbits = sizeof(long long)*8; goto done; \ } \ } else \ @@ -483,27 +483,27 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(int *)&buf[i] = (int)(((unsigned int)1 << *minbits) - 1); \ else \ *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(long *)&buf[i] = (long)(((unsigned long)1 << *minbits) - 1); \ else \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) { \ - if(HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \ + if(HDfabs(buf[i] - filval) < HDpow(10.0f, -D_val)) \ *(long long *)&buf[i] = (long long)(((unsigned long long)1 << *minbits) - 1); \ else \ *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ } \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ @@ -515,15 +515,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ *(int *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ *(long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ *(long long *)&buf[i] = H5Z_scaleoffset_rnd( \ - buf[i]*HDpow(10.0, D_val) - min*HDpow(10.0, D_val)); \ + buf[i]*HDpow(10.0f, D_val) - min*HDpow(10.0f, D_val)); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype")\ } @@ -560,14 +560,14 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0, D_val) - min * HDpow(10.0, D_val)) + 1; \ + span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ *minbits = H5Z_scaleoffset_log2((unsigned long long)(span + 1)); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_1(i, type, buf, d_nelmts, filval, minbits, min, D_val) \ } else { /* fill value undefined */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_3(i, type, max, min, minbits, D_val) \ - span = H5Z_scaleoffset_rnd(max * HDpow(10.0, D_val) - min * HDpow(10.0, D_val)) + 1; \ + span = H5Z_scaleoffset_rnd(max * HDpow(10.0f, D_val) - min * HDpow(10.0f, D_val)) + 1; \ *minbits = H5Z_scaleoffset_log2((unsigned long long)span); \ if(*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_2(i, type, buf, d_nelmts, min, D_val) \ @@ -628,15 +628,15 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(int *)&buf[i] == (int)(((unsigned int)1 << minbits) - 1)) ? \ - filval : (double)(*(int *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long *)&buf[i] == (long)(((unsigned long)1 << minbits) - 1)) ? \ - filval : (double)(*(long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ buf[i] = (type)((*(long long *)&buf[i] == (long long)(((unsigned long long)1 << minbits) - 1)) ? \ - filval : (double)(*(long long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + filval : (double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -646,13 +646,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ if(sizeof(type)==sizeof(int)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(int *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(int *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else if(sizeof(type)==sizeof(long long)) \ for(i = 0; i < d_nelmts; i++) \ - buf[i] = (type)((double)(*(long long *)&buf[i]) / HDpow(10.0, D_val) + min); \ + buf[i] = (type)((double)(*(long long *)&buf[i]) / HDpow(10.0f, D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ } @@ -1047,7 +1047,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value unsigned filavail; /* flag indicating if fill value is defined or not */ H5Z_SO_scale_type_t scale_type = H5Z_SO_FLOAT_DSCALE;/* scale type */ int scale_factor = 0; /* scale factor */ - double D_val = 0.0; /* decimal scale factor */ + double D_val = 0.0f; /* decimal scale factor */ uint32_t minbits = 0; /* minimum number of bits to store values */ unsigned long long minval= 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */ diff --git a/src/H5config.h.in b/src/H5config.h.in index fc41c5a..a86970a 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -17,6 +17,9 @@ /* Define if C++ compiler recognizes offsetof */ #undef CXX_HAVE_OFFSETOF +/* Define the default plugins path to compile */ +#undef DEFAULT_PLUGIN + /* Define the default virtual file driver to compile */ #undef DEFAULT_VFD diff --git a/src/H5private.h b/src/H5private.h index 74b918f..2bfcb70 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2378,6 +2378,25 @@ func_init_failed: \ #define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0) */ +/* Macros for enabling/disabling particular GCC warnings */ +/* (see the following web-sites for more info: + * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html + * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas + */ +/* These pragmas are only implemented usefully in gcc 4.6+ */ +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 + #define GCC_DIAG_STR(s) #s + #define GCC_DIAG_JOINSTR(x,y) GCC_DIAG_STR(x ## y) + #define GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) + #define GCC_DIAG_PRAGMA(x) GCC_DIAG_DO_PRAGMA(GCC diagnostic x) + + #define GCC_DIAG_OFF(x) GCC_DIAG_PRAGMA(push) GCC_DIAG_PRAGMA(ignored GCC_DIAG_JOINSTR(-W,x)) + #define GCC_DIAG_ON(x) GCC_DIAG_PRAGMA(pop) +#else + #define GCC_DIAG_OFF(x) + #define GCC_DIAG_ON(x) +#endif + /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5_init_library(void); H5_DLL void H5_term_library(void); diff --git a/src/Makefile.am b/src/Makefile.am index 49676ed..2e16d52 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,7 +27,7 @@ include $(top_srcdir)/config/lt_vers.am # a long time to compile it with any optimization on. H5detect is used # to generate H5Tinit.c once. So, optimization is not critical. noinst_PROGRAMS = H5detect H5make_libsettings -H5detect_CFLAGS = -g $(AM_CFLAGS) +H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES=libhdf5.la diff --git a/src/Makefile.in b/src/Makefile.in index 0f435f5..de6ae97 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -527,7 +527,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog LT_VERS_INTERFACE = 6 LT_VERS_REVISION = 154 LT_VERS_AGE = 0 -H5detect_CFLAGS = -g $(AM_CFLAGS) +H5detect_CFLAGS = $(AM_CFLAGS) -g -O0 # Our main target, the HDF5 library lib_LTLIBRARIES = libhdf5.la diff --git a/test/dsets.c b/test/dsets.c index 3d8ae2c..b1813a5 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1111,10 +1111,10 @@ test_conv_buffer(hid_t fid) cf->a[j][k][l] = 10*(j+1) + l + k; for(j = 0; j < DIM2; j++) - cf->b[j] = (float)(100.*(j+1) + 0.01*j); + cf->b[j] = (float)(100.0f*(j+1) + 0.01f*j); for(j = 0; j < DIM3; j++) - cf->c[j] = 100.*(j+1) + 0.02*j; + cf->c[j] = 100.0f*(j+1) + 0.02f*j; /* Create data space */ @@ -2858,7 +2858,7 @@ test_nbit_int(hid_t file) for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { orig_data[i][j] = (int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision - 1))) << offset); + (long long)HDpow(2.0f, (double)(precision - 1))) << offset); /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -2960,8 +2960,8 @@ test_nbit_float(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - float orig_data[2][5] = {{(float)188384.00, (float)19.103516, (float)-1.0831790e9, (float)-84.242188, - (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}}; + float orig_data[2][5] = {{(float)188384.00f, (float)19.103516f, (float)-1.0831790e9f, (float)-84.242188f, + (float)5.2045898f}, {(float)-49140.000f, (float)2350.2500f, (float)-3.2110596e-1f, (float)6.4998865e-5f, (float)-0.0000000f}}; float new_data[2][5]; size_t precision, offset; size_t i, j; diff --git a/test/dtypes.c b/test/dtypes.c index 117a21a..de64713 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1859,7 +1859,7 @@ test_compound_10(void) hsize_t dim1[1]; void *t1, *t2; char filename[1024]; - int len; + size_t len; int i; TESTING("array datatype of compound type with VL string"); @@ -1867,12 +1867,12 @@ test_compound_10(void) for(i=0; i=0; --i) { char pattern[3]; - pattern[2] = i; + pattern[2] = (char)i; pattern[0] = pattern[1] = 0; H5Tenum_insert(srctype, mname[i], pattern); } @@ -4549,7 +4549,7 @@ test_conv_enum_2(void) /* Source data */ data = (int*)malloc(NTESTELEM*sizeof(int)); for (i=0; idatasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -302,7 +302,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -313,14 +313,14 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } else if(found_obj->displayed) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; @@ -329,12 +329,12 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -345,7 +345,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Dclose(obj); goto done; @@ -398,7 +398,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->softlinkbegin, name, h5tools_dump_header_format->softlinkblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; @@ -411,18 +411,18 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* print the value of a soft link */ /* Standard DDL: no modification */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -433,7 +433,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->softlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(targbuf); break; @@ -443,14 +443,14 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED HDassert(targbuf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->extlinkbegin, name, h5tools_dump_header_format->extlinkblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { indentation(dump_indent); @@ -472,20 +472,20 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* dump the external link */ dump_extlink(group, name, targname); @@ -493,7 +493,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } /* end else */ } /* end else */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -504,35 +504,35 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->extlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(targbuf); break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->udlinkbegin, name, h5tools_dump_header_format->udlinkblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) { @@ -542,7 +542,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(HDstrlen(h5tools_dump_header_format->udlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } /* end switch */ @@ -684,7 +684,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datatypebegin, name, h5tools_dump_header_format->datatypeblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Oget_info(tid, &oinfo); @@ -705,7 +705,7 @@ dump_named_datatype(hid_t tid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); goto done; } else @@ -720,7 +720,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_str_append(&buffer, ";"); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print attributes */ dump_indent += COL; @@ -739,7 +739,7 @@ done: } if(HDstrlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -831,7 +831,7 @@ dump_group(hid_t gid, const char *name) h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -877,7 +877,7 @@ dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { found_obj->displayed = TRUE; @@ -894,7 +894,7 @@ dump_group(hid_t gid, const char *name) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -905,7 +905,7 @@ dump_group(hid_t gid, const char *name) } if(HDstrlen(h5tools_dump_header_format->groupend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -974,14 +974,14 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_dump_comment(rawoutstream, outputformat, &ctx, did); @@ -1016,25 +1016,25 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) for(i=0; iline_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } switch(H5Tget_class(type)) { case H5T_TIME: ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "DATA{ not yet implemented.}"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; break; @@ -1068,7 +1068,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1079,7 +1079,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -1346,7 +1346,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *ainfo, vo if(op_name[0] != '/') { HDstrncat(obj_name, buf, (size_t)i + 1); if(buf[i-1] != '/') - HDstrncat(obj_name, "/", 2); + HDstrncat(obj_name, "/", (size_t)2); } HDstrncat(obj_name, op_name, (size_t)j + 1); @@ -1407,7 +1407,7 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data) } else k = 1; - search_name = (char *)HDmalloc(search_len + k); + search_name = (char *)HDmalloc((size_t)(search_len + k)); if(search_name == NULL) { error_msg("creating temporary link\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1578,19 +1578,19 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe HDmemset(&buffer, 0, sizeof(h5tools_str_t)); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr, h5tools_dump_header_format->attributeblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); error_msg("unable to open object \"%s\"\n", obj_name); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->attributeblockend)) { @@ -1600,7 +1600,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe } if(HDstrlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); diff --git a/tools/h5dump/h5dump_defines.h b/tools/h5dump/h5dump_defines.h index 66d73e3..5f2df43 100644 --- a/tools/h5dump/h5dump_defines.h +++ b/tools/h5dump/h5dump_defines.h @@ -25,7 +25,7 @@ /* Macros for displaying objects */ #define begin_obj(obj,name,begin) \ do { \ - if (name) \ + if ((name)) \ PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \ else \ PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \ diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index d80c6c2..d55bf43 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -239,19 +239,19 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name, h5tools_dump_header_format->datasetblockbegin); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -262,7 +262,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU } if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -282,11 +282,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU char pointerxid[100]; /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1); + xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -299,31 +299,31 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU t_obj_path, /* H5Path */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); + xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid,t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_name); HDfree(t_obj_path); @@ -401,15 +401,15 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU } /* end else */ /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); /* Try to create an OBJ-XID for the object pointed to */ - res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0); + res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0); if (res == 0) { /* target obj found */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -426,12 +426,12 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU targetxid, /* TargetObj */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { /* dangling link -- omit from xml attributes */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -447,7 +447,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU t_targbuf, /* TargetPath */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } HDfree(t_prefix); @@ -488,11 +488,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU char *t_targname = xml_escape_the_name(targname); /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -510,7 +510,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU targname, /* TargetPath*/ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_prefix); HDfree(t_name); @@ -531,11 +531,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU char *t_obj_path = xml_escape_the_name(obj_path); /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -551,7 +551,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU linfo->type, /* LinkClass */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_prefix); HDfree(t_name); @@ -903,7 +903,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* This should be defined somewhere else */ /* These 2 cases are handled the same right now, but probably will have something different eventually */ - char * dtxid = (char *)HDmalloc(100); + char * dtxid = (char *)HDmalloc((size_t)100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -911,38 +911,38 @@ xml_print_datatype(hid_t type, unsigned in_group) as it's name. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", xmlnsprefix, dtxid); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { /* point to the NDT by name */ char *t_objname = xml_escape_the_name(found_obj->objname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, dtxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); } HDfree(dtxid); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_setstatus(EXIT_FAILURE); } } @@ -951,12 +951,12 @@ xml_print_datatype(hid_t type, unsigned in_group) switch (H5Tget_class(type)) { case H5T_INTEGER: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; /* */ @@ -964,7 +964,7 @@ xml_print_datatype(hid_t type, unsigned in_group) sgn = H5Tget_sign(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -998,16 +998,16 @@ xml_print_datatype(hid_t type, unsigned in_group) sz = H5Tget_size(type); h5tools_str_append(&buffer, "%lu", (unsigned long)sz); h5tools_str_append(&buffer, "\" />"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_FLOAT: @@ -1018,16 +1018,16 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1054,45 +1054,45 @@ xml_print_datatype(hid_t type, unsigned in_group) h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_TIME: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_append(&buffer, ""); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_STRING: @@ -1103,17 +1103,17 @@ xml_print_datatype(hid_t type, unsigned in_group) is_vlstr = H5Tis_variable_str(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1140,16 +1140,16 @@ xml_print_datatype(hid_t type, unsigned in_group) else { h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_BITFIELD: @@ -1157,16 +1157,16 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1186,33 +1186,33 @@ xml_print_datatype(hid_t type, unsigned in_group) size = H5Tget_size(type); h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_OPAQUE: /* */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; mname = H5Tget_tag(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1220,16 +1220,16 @@ xml_print_datatype(hid_t type, unsigned in_group) HDfree(mname); size = H5Tget_size(type); h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_COMPOUND: @@ -1239,12 +1239,12 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembers = H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* List each member Field of the type */ /* */ @@ -1259,12 +1259,12 @@ xml_print_datatype(hid_t type, unsigned in_group) t_fname = xml_escape_the_name(mname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(mname); HDfree(t_fname); @@ -1272,12 +1272,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; xml_print_datatype(mtype,0); @@ -1285,80 +1285,80 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } dump_indent -= COL; ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; /* Only Object references supported at this time */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_ENUM: @@ -1366,62 +1366,62 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembs = H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent += COL; ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); xml_print_enum(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_VLEN: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); super = H5Tget_super(type); dump_indent += COL; ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent += COL; ctx.indent_level++; xml_print_datatype(super,0); @@ -1429,22 +1429,22 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Tclose(super); break; @@ -1455,14 +1455,14 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Print lead-in */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix); ndims = H5Tget_array_ndims(type); h5tools_str_append(&buffer, "%u\">", ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Get array information */ H5Tget_array_dims2(type, dims); @@ -1471,12 +1471,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; for (i = 0; i < ndims; i++) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; @@ -1484,12 +1484,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent += COL; ctx.indent_level++; xml_print_datatype(super,0); @@ -1497,34 +1497,34 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_indent -= COL; ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Close array base type */ H5Tclose(super); break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_setstatus(EXIT_FAILURE); break; } @@ -1593,7 +1593,7 @@ xml_dump_datatype(hid_t type) if(found_obj) { /* Shared datatype, must be entered as an object */ /* These 2 cases are the same now, but may change */ - char *dtxid = (char *)HDmalloc(100); + char *dtxid = (char *)HDmalloc((size_t)100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -1604,48 +1604,48 @@ xml_dump_datatype(hid_t type) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", xmlnsprefix, dtxid); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { /* pointer to a named datatype already in XML */ char *t_objname = xml_escape_the_name(found_obj->objname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />", xmlnsprefix, dtxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); } HDfree(dtxid); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; xml_print_datatype(type, 0); @@ -1653,12 +1653,12 @@ xml_dump_datatype(hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; dump_indent -= COL; @@ -1721,12 +1721,12 @@ xml_dump_dataspace(hid_t space) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; switch (space_type) { @@ -1734,12 +1734,12 @@ xml_dump_dataspace(hid_t space) /* scalar dataspace (just a tag, no XML attrs. defined */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5S_SIMPLE: @@ -1747,56 +1747,56 @@ xml_dump_dataspace(hid_t space) /* */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print the elements */ ctx.indent_level++; for (i = 0; i < ndims; i++) { if (maxsize[i] == H5S_UNLIMITED) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>", xmlnsprefix,size[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else if (maxsize[i] == (hsize_t) 0) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", xmlnsprefix,size[i], size[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", xmlnsprefix, size[i], maxsize[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } } ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix ); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; #ifdef TMP @@ -1805,35 +1805,35 @@ xml_dump_dataspace(hid_t space) /* null dataspace (just a tag, no XML attrs. defined */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; #endif /* TMP */ case H5S_NO_CLASS: default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; h5tools_str_close(&buffer); @@ -1902,22 +1902,22 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2002,12 +2002,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "Unable to print data."); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2023,17 +2023,17 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2092,12 +2092,12 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_aname); if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { @@ -2128,44 +2128,44 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -2173,112 +2173,112 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); break; case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if (!H5Tequal(type, H5T_STD_REF_OBJ)) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); xml_print_refs(attr_id, ATTRIBUTE_DATA); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_VLEN: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } } @@ -2286,32 +2286,32 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, /* The case of an attribute never yet written ?? * Or dataspace is H5S_NULL. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; dump_indent -= COL; @@ -2321,12 +2321,12 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, H5Aclose(attr_id); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); return SUCCEED; @@ -2336,22 +2336,22 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); @@ -2417,15 +2417,15 @@ xml_dump_named_datatype(hid_t type, const char *name) string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - dtxid = (char *)HDmalloc(100); - parentxid = (char *)HDmalloc(100); + dtxid = (char *)HDmalloc((size_t)100); + parentxid = (char *)HDmalloc((size_t)100); t_tmp = xml_escape_the_name(tmp); t_prefix = xml_escape_the_name(prefix); t_name = xml_escape_the_name(name); xml_name_to_XID(tmp, dtxid, 100, 1); xml_name_to_XID(prefix, parentxid, 100, 1); - if(HDstrncmp(name, "#", 1) == 0) { + if(HDstrncmp(name, "#", (size_t)1) == 0) { /* Special: this is an 'anonymous' NDT, deleted but still in use. We follow the dumper's undocumented practice, and @@ -2436,7 +2436,7 @@ xml_dump_named_datatype(hid_t type, const char *name) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2445,13 +2445,13 @@ xml_dump_named_datatype(hid_t type, const char *name) xmlnsprefix, name, dtxid, parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { H5O_info_t oinfo; /* Object info */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2460,7 +2460,7 @@ xml_dump_named_datatype(hid_t type, const char *name) xmlnsprefix, t_name, dtxid, t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Check uniqueness of named datatype */ H5Oget_info(type, &oinfo); @@ -2485,25 +2485,25 @@ xml_dump_named_datatype(hid_t type, const char *name) ctx.indent_level++; - xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); + xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); goto done; } @@ -2516,12 +2516,12 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -2530,23 +2530,23 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); done: @@ -2674,11 +2674,11 @@ xml_dump_group(hid_t gid, const char *name) } else { char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)HDmalloc(100); - char *parentxid = (char *)HDmalloc(100); + char *grpxid = (char *)HDmalloc((size_t)100); + char *parentxid = (char *)HDmalloc((size_t)100); if(found_obj->displayed) { - char *ptrstr = (char *)HDmalloc(100); + char *ptrstr = (char *)HDmalloc((size_t)100); /* already seen: enter a groupptr */ if(isRoot) { @@ -2686,13 +2686,13 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { t_objname = xml_escape_the_name(found_obj->objname); @@ -2701,7 +2701,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2709,7 +2709,7 @@ xml_dump_group(hid_t gid, const char *name) "Parents=\"%s\" H5ParentPaths=\"%s\">", xmlnsprefix,t_name, grpxid, get_next_xid(), t_objname, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_objname); HDfree(par_name); @@ -2721,7 +2721,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2729,7 +2729,7 @@ xml_dump_group(hid_t gid, const char *name) "Parents=\"%s\" H5ParentPaths=\"%s\" />", xmlnsprefix, ptrstr, t_objname, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; @@ -2745,13 +2745,13 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_tmp = xml_escape_the_name(tmp); @@ -2761,14 +2761,14 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >", xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_tmp); HDfree(par_name); @@ -2827,11 +2827,11 @@ xml_dump_group(hid_t gid, const char *name) else { /* only link -- must be first time! */ char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)HDmalloc(100); - char *parentxid = (char *)HDmalloc(100); + char *grpxid = (char *)HDmalloc((size_t)100); + char *parentxid = (char *)HDmalloc((size_t)100); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2852,7 +2852,7 @@ xml_dump_group(hid_t gid, const char *name) HDfree(t_tmp); HDfree(par_name); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_name); HDfree(grpxid); @@ -2904,7 +2904,7 @@ xml_dump_group(hid_t gid, const char *name) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2912,7 +2912,7 @@ xml_dump_group(hid_t gid, const char *name) h5tools_str_append(&buffer, "", xmlnsprefix); else h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); @@ -3037,23 +3037,23 @@ xml_print_refs(hid_t did, int source) if (!path) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_path = xml_escape_the_string(path, -1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_path); } ctx.indent_level--; @@ -3203,23 +3203,23 @@ xml_print_strs(hid_t did, int source) if (!onestring) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_onestring = xml_escape_the_string(onestring, (int) str_size); if (t_onestring) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_onestring); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_onestring); } } @@ -3310,11 +3310,11 @@ check_filters(hid_t dcpl) if (nfilt <= 0) return; for (i = 0; i < nfilt; i++) { - filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, 120, namebuf, NULL); + filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, (size_t)120, namebuf, NULL); if (filter == H5Z_FILTER_DEFLATE) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3327,36 +3327,36 @@ check_filters(hid_t dcpl) h5tools_str_append(&buffer, "%d", cd_values[0]); } h5tools_str_append(&buffer, "\"/>"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (filter == H5Z_FILTER_FLETCHER32) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (filter == H5Z_FILTER_SHUFFLE) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (filter == H5Z_FILTER_SZIP) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3397,7 +3397,7 @@ check_filters(hid_t dcpl) h5tools_str_append(&buffer, "Header=\"Raw\""); } h5tools_str_append(&buffer, "/>"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else { @@ -3450,12 +3450,12 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -3468,126 +3468,126 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) const char * path = lookup_ref_path(*(hobj_ref_t *) buf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if (!path) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { char *t_path = xml_escape_the_string(path, -1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", t_path); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_path); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else if (H5Tget_class(type) == H5T_STRING) { /* ????? */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { /* all other data */ switch (H5Tget_class(type)) { case H5T_INTEGER: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%d\"", *(int *) buf); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_FLOAT: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%f\"", *(float *) buf); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_BITFIELD: case H5T_OPAQUE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); sz = H5Tget_size(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3597,126 +3597,126 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) buf = (char *) buf + sizeof(unsigned int); } h5tools_str_append(&buffer, "\""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_ENUM: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); name = H5Tget_member_name(type, *(unsigned *) buf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_ARRAY: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_TIME: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_VLEN: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } } @@ -3725,12 +3725,12 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -3777,8 +3777,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) h5tool_format_t string_dataformat; hsize_t curr_pos = 0; /* total data element position */ - char *rstr = (char*) HDmalloc(100); - char *pstr = (char*) HDmalloc(100); + char *rstr = (char*) HDmalloc((size_t)100); + char *pstr = (char*) HDmalloc((size_t)100); tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDstrcpy(tmp, prefix); @@ -3817,14 +3817,14 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) xml_name_to_XID(prefix, pstr, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", xmlnsprefix, t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_name); HDfree(t_tmp); @@ -3849,24 +3849,24 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix); ndims = H5Pget_chunk(dcpl, maxdims, chsize); h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -3874,21 +3874,21 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) for (i = 0; i < ndims; i++) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -3897,33 +3897,33 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; HDfree(chsize); @@ -3932,60 +3932,60 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else if (H5D_COMPACT == H5Pget_layout(dcpl)) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } /* and check for external.... ?? */ @@ -3996,7 +3996,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4037,30 +4037,30 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) } h5tools_str_append(&buffer, "\""); h5tools_str_append(&buffer, ">"); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5Pfill_value_defined(dcpl, &fvstatus); if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } else { @@ -4068,23 +4068,23 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; @@ -4132,48 +4132,48 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; break; case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -4184,68 +4184,68 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); if (!H5Tequal(type, H5T_STD_REF_OBJ)) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); xml_print_refs(did, DATASET_DATA); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; case H5T_VLEN: ctx.indent_level--; dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ""); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; dump_indent += COL; @@ -4257,36 +4257,36 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", H5Tget_class(type)); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); break; } } @@ -4295,30 +4295,30 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; } @@ -4327,12 +4327,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) H5Pclose(dcpl); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "", xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -4396,22 +4396,22 @@ xml_print_enum(hid_t type) super = H5Tget_super(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); xml_print_datatype(super,0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* * Determine what datatype to use for the native values. To simplify @@ -4435,8 +4435,8 @@ xml_print_enum(hid_t type) } /* Get the names and raw values of all members */ - name = (char **)HDcalloc(nmembs, sizeof(char *)); - value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size)); + 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 < nmembs; i++) { name[i] = H5Tget_member_name(type, i); @@ -4445,7 +4445,7 @@ xml_print_enum(hid_t type) /* Convert values to native datatype */ if (native > 0) - H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); + H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT); /* Sort members by increasing value */ /*not implemented yet */ @@ -4457,41 +4457,41 @@ xml_print_enum(hid_t type) char *t_name = xml_escape_the_name(name[i]); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", t_name); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); HDfree(t_name); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4509,16 +4509,16 @@ xml_print_enum(hid_t type) h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) (value + i * dst_size)))); } - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "",xmlnsprefix); - h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; dump_indent -= COL; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 81cef5f..76426c2 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -3850,7 +3850,7 @@ static void write_attr_in(hid_t loc_id, /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ + char buf1[2][3]= {"ab","de"}; /* string */ char buf2[2]= {1,2}; /* bitfield, opaque */ s_t buf3[2]= {{1,2},{3,4}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ @@ -3862,7 +3862,7 @@ static void write_attr_in(hid_t loc_id, /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; - char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ @@ -3873,7 +3873,7 @@ static void write_attr_in(hid_t loc_id, /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; - char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq", "rs","tu","vw","xz","AB","CD","EF","GH", "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ char buf23[4][3][2]; /* bitfield, opaque */ @@ -4292,7 +4292,7 @@ static void write_dset_in(hid_t loc_id, /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ + char buf1[2][3]= {"ab","de"}; /* string */ char buf2[2]= {1,2}; /* bitfield, opaque */ s_t buf3[2]= {{1,2},{3,4}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ @@ -4304,7 +4304,7 @@ static void write_dset_in(hid_t loc_id, /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; - char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ @@ -4315,7 +4315,7 @@ static void write_dset_in(hid_t loc_id, /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; - char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq", "rs","tu","vw","xz","AB","CD","EF","GH", "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ char buf23[4][3][2]; /* bitfield, opaque */ diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index be05705..1a0f189 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -797,6 +797,40 @@ TOOLTEST5() { fi } +# ADD_HELP_TEST +TOOLTEST_HELP() { + + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .txt`.out" + actual_err="$TESTDIR/`basename $1 .txt`.err" + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect-CREATED + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected output (*.txt) differs from actual output (*.out)" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi + +} # Print a "SKIP" message SKIP() { @@ -873,7 +907,7 @@ IMPORTTEST() # prepare for test COPY_TESTFILES_TO_TESTDIR -#TOOLTEST h5dump-help.txt -h +TOOLTEST_HELP h5dump-help.txt -h # test data output redirection TOOLTEST tnoddl.ddl --enable-error-stack --ddl -y packedbits.h5 diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 52eb0aa..ab38f65 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -327,7 +327,7 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - h5fsize = sbuf2.st_size; + h5fsize = (hsize_t)sbuf2.st_size; if (output_file == NULL) { ofid = HDopen (input_file, O_WRONLY, 0); @@ -385,16 +385,19 @@ main (int argc, const char *argv[]) /* pad the ub */ where = write_pad (ofid, where); - if (ub_file) + if(ub_file) HDfree (ub_file); - if (input_file) + if(input_file) HDfree (input_file); - if (output_file) + if(output_file) HDfree (output_file); - if (ufid >= 0) HDclose (ufid); - if (h5fid >= 0) HDclose (h5fid); - if (ofid >= 0) HDclose (ofid); + if(ufid >= 0) + HDclose (ufid); + if(h5fid >= 0) + HDclose (h5fid); + if(ofid >= 0) + HDclose (ofid); return h5tools_getstatus(); } diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index f03ad69..176fc2b 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -44,6 +44,41 @@ IF (BUILD_TESTING) TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) SET_TARGET_PROPERTIES (h5repacktest PROPERTIES FOLDER tools) + #----------------------------------------------------------------------------- + # If plugin library tests can be tested + #----------------------------------------------------------------------------- + IF (BUILD_SHARED_LIBS) + SET (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + SET (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + SET (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) + INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) + + ADD_LIBRARY (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SRC_DIR}/dynlib1.c) + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} " " " ") + TARGET_LINK_LIBRARIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS ( + ${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} + ${LIB_TYPE} + HDF5_TOOL_PLUGIN_LIB_NAME_RELEASE + HDF5_TOOL_PLUGIN_LIB_NAME_DEBUG + ) + + # make plugins dir + FILE (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + ADD_CUSTOM_COMMAND ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) + ENDIF (BUILD_SHARED_LIBS) + INCLUDE (CMakeTests.cmake) ENDIF (BUILD_TESTING) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index c27aaa0..7f8f71b 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -79,12 +79,15 @@ ) SET (LIST_OTHER_TEST_FILES + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack-help.txt ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.bin ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/ublock.bin ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack.info + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/deflate_limit.h5repack_layout.h5.ddl ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5.ddl - # tools/testfiles - ${HDF5_TOOLS_SRC_DIR}/testfiles/h5repack_filters.h5.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5.tst + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_test.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5.tst ) FOREACH (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) @@ -105,6 +108,37 @@ ############################################################################## ############################################################################## + MACRO (ADD_HELP_TEST testname resultcode) + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5REPACK-${testname} COMMAND $ ${ARGN}) + SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5REPACK-${testname}") + ELSE (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME H5REPACK-h5repack-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove h5repack-${testname}.out h5repack-${testname}.out.err + ) + SET_TESTS_PROPERTIES (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + ADD_TEST ( + NAME H5REPACK-h5repack-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=h5repack-${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=h5repack-${testname}.txt" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS "H5REPACK-h5repack-${testname}-clear-objects") + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_HELP_TEST) + MACRO (ADD_H5_TEST_OLD testname testtype testfile) IF (${testtype} STREQUAL "SKIP") IF (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -177,7 +211,7 @@ -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" - -D "TEST_REFERENCE=testfiles/${resultfile}.ddl" + -D "TEST_REFERENCE=testfiles/${resultfile}.tst" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) @@ -212,7 +246,7 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=testfiles/${resultfile}.ddl" + -D "TEST_REFERENCE=testfiles/${testname}.${resultfile}.ddl" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) SET_TESTS_PROPERTIES (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") @@ -303,6 +337,51 @@ SET_TESTS_PROPERTIES (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M) ENDMACRO (ADD_H5_TEST_META) + MACRO (ADD_H5_UD_TEST testname resultcode resultfile) + IF (HDF5_BUILD_TOOLS AND NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5REPACK_UD-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${resultfile} + testfiles/${testname}.${resultfile}.out + testfiles/${testname}.${resultfile}.out.err + testfiles/${resultfile}-${testname}.out + testfiles/${resultfile}-${testname}.out.err + ) + ADD_TEST ( + NAME H5REPACK_UD-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN};${PROJECT_BINARY_DIR}/testfiles/${resultfile};${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_FILTER:STRING=O?...ing file[^\n]+\n" + -D "TEST_OUTPUT=./testfiles/${testname}.${resultfile}.out" + -D "TEST_REFERENCE=testfiles/${testname}.${resultfile}.tst" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-clearall-objects) + ADD_TEST ( + NAME H5REPACK_UD-h5dump-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=-pH;testfiles/out-${testname}.${resultfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=testfiles/${resultfile}-${testname}.ddl" + -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" + -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}") + ENDIF (HDF5_BUILD_TOOLS AND NOT HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_UD_TEST) + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -333,12 +412,13 @@ SET (FILE18 h5repack_layout2.h5) SET (FILE_REF h5repack_refs.h5) SET (FILE_ATTR_REF h5repack_attr_refs.h5) - + # Remove any output file left over from previous test run ADD_TEST ( NAME H5REPACK-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove + ./testfiles/h5dump-help.out ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out.err ./testfiles/h5repack_layout.h5-chunk_18x13-v.out @@ -353,6 +433,8 @@ ./testfiles/h5repack_layout.h5-compa-v.out.err ./testfiles/h5repack_layout.h5-conti-v.out ./testfiles/h5repack_layout.h5-conti-v.out.err + ./testfiles/h5repack_layout.h5-deflate_limit.out + ./testfiles/h5repack_layout.h5-deflate_limit.out.err ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out.err ./testfiles/h5repack_layout.h5-dset2_compa-v.out @@ -375,10 +457,16 @@ ./testfiles/h5repack_layout.h5-layout_long_switches-v.out.err ./testfiles/h5repack_layout.h5-layout_short_switches-v.out ./testfiles/h5repack_layout.h5-layout_short_switches-v.out.err + ./testfiles/h5repack_layout.h5-plugin_test.out + ./testfiles/h5repack_layout.h5-plugin_test.out.err ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out.err ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out.err + ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out + ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out.err + ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out + ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out.err ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out.err ./testfiles/h5repack_layout3.h5-chunk2compa-v.out @@ -431,11 +519,14 @@ ./testfiles/out-layout_long_switches.h5repack_layout.h5 ./testfiles/out-layout_short_switches.h5repack_layout.h5 ./testfiles/out-old_style_layout_short_switches.h5repack_layout.h5 + ./testfiles/out-plugin_test.h5repack_layout.h5 ./testfiles/out-shuffle_all.h5repack_layout.h5 ./testfiles/out-shuffle_individual.h5repack_layout.h5 ./testfiles/out-upgrade_layout.h5repack_layouto.h5 ./testfiles/out-contig_small_compa.h5repack_layout2.h5 ./testfiles/out-contig_small_fixed_compa.h5repack_layout2.h5 + ./testfiles/out-ckdim_biger.h5repack_layout3.h5 + ./testfiles/out-ckdim_smaller.h5repack_layout3.h5 ./testfiles/out-chunk2chunk.h5repack_layout3.h5 ./testfiles/out-chunk2compa.h5repack_layout3.h5 ./testfiles/out-chunk2conti.h5repack_layout3.h5 @@ -507,6 +598,8 @@ SET_TESTS_PROPERTIES (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") + ADD_HELP_TEST(help 0 -h) + ADD_TEST (NAME H5REPACK-testh5repack_detect_szip COMMAND $) IF (HDF5_ENABLE_SZIP_SUPPORT) IF (HDF5_ENABLE_SZIP_ENCODING) @@ -965,6 +1058,19 @@ ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CO ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192) ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192) +############################################################################## +### P L U G I N T E S T S +############################################################################## +IF (BUILD_SHARED_LIBS) + ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9) +ELSE (BUILD_SHARED_LIBS) + MESSAGE (STATUS " **** Plugins libraries must be built as shared libraries **** ") + ADD_TEST ( + NAME H5REPACK-plugin + COMMAND ${CMAKE_COMMAND} -E echo "SKIP H5PLUGIN TESTING" + ) +ENDIF (BUILD_SHARED_LIBS) + IF (HDF5_TEST_VFD) # Run test with different Virtual File Driver FOREACH (vfd ${VFD_LIST}) diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am index 96f0082..c52112b 100644 --- a/tools/h5repack/Makefile.am +++ b/tools/h5repack/Makefile.am @@ -28,11 +28,14 @@ TEST_SCRIPT=h5repack.sh TEST_PROG=h5repacktst noinst_PROGRAMS=testh5repack_detect_szip +SCRIPT_DEPEND=h5repack$(EXEEXT) +if HAVE_SHARED_CONDITIONAL + TEST_SCRIPT += h5repack_plugin.sh +endif + check_SCRIPTS=$(TEST_SCRIPT) check_PROGRAMS=$(TEST_PROG) -SCRIPT_DEPEND=h5repack$(EXEEXT) - # Our main target, h5repack tool bin_PROGRAMS=h5repack @@ -56,9 +59,18 @@ testh5repack_detect_szip_SOURCES=testh5repack_detect_szip.c # The h5repack.sh script needs h5repacktst to run first. h5repack.sh.chkexe_: h5repacktst.chkexe_ +if HAVE_SHARED_CONDITIONAL + # Build it as shared library if configure is enabled for shared library. + lib_LTLIBRARIES=libdynlibadd.la + libdynlibadd_la_SOURCES=$(top_srcdir)/test/dynlib1.c + +install-exec-hook: + $(RM) $(DESTDIR)$(libdir)/*dynlib* +endif + # Temporary files. *.h5 are generated by h5repack. They should # copied to the testfiles/ directory if update is required. CHECK_CLEANFILES+=*.h5 *.bin -DISTCLEANFILES=h5repack.sh +DISTCLEANFILES=h5repack.sh h5repack_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index fe3a11c..addb530 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -31,6 +31,7 @@ # HDF5 Library Makefile(.in) # + VPATH = @srcdir@ am__make_dryrun = \ { \ @@ -68,11 +69,12 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/h5repack.sh.in $(top_srcdir)/bin/depcomp \ - $(top_srcdir)/bin/mkinstalldirs \ + $(srcdir)/h5repack.sh.in $(srcdir)/h5repack_plugin.sh.in \ + $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am noinst_PROGRAMS = testh5repack_detect_szip$(EXEEXT) +@HAVE_SHARED_CONDITIONAL_TRUE@am__append_1 = h5repack_plugin.sh check_PROGRAMS = $(am__EXEEXT_1) bin_PROGRAMS = h5repack$(EXEEXT) TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT) @@ -83,9 +85,47 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = h5repack.sh +CONFIG_CLEAN_FILES = h5repack.sh h5repack_plugin.sh CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libdynlibadd_la_LIBADD = +am__libdynlibadd_la_SOURCES_DIST = $(top_srcdir)/test/dynlib1.c +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibadd_la_OBJECTS = dynlib1.lo +libdynlibadd_la_OBJECTS = $(am_libdynlibadd_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlibadd_la_rpath = -rpath \ +@HAVE_SHARED_CONDITIONAL_TRUE@ $(libdir) am__EXEEXT_1 = h5repacktst$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am__objects_1 = h5repack.$(OBJEXT) h5repack_copy.$(OBJEXT) \ @@ -96,10 +136,6 @@ am_h5repack_OBJECTS = $(am__objects_1) h5repack_main.$(OBJEXT) h5repack_OBJECTS = $(am_h5repack_OBJECTS) h5repack_LDADD = $(LDADD) h5repack_DEPENDENCIES = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = h5repack_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(h5repack_LDFLAGS) $(LDFLAGS) -o $@ @@ -148,10 +184,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(h5repack_SOURCES) $(h5repacktst_SOURCES) \ - $(testh5repack_detect_szip_SOURCES) -DIST_SOURCES = $(h5repack_SOURCES) $(h5repacktst_SOURCES) \ - $(testh5repack_detect_szip_SOURCES) +SOURCES = $(libdynlibadd_la_SOURCES) $(h5repack_SOURCES) \ + $(h5repacktst_SOURCES) $(testh5repack_detect_szip_SOURCES) +DIST_SOURCES = $(am__libdynlibadd_la_SOURCES_DIST) $(h5repack_SOURCES) \ + $(h5repacktst_SOURCES) $(testh5repack_detect_szip_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -450,10 +486,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.bin INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib # Test programs and scripts -TEST_SCRIPT = h5repack.sh +TEST_SCRIPT = h5repack.sh $(am__append_1) TEST_PROG = h5repacktst -check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5repack$(EXEEXT) +check_SCRIPTS = $(TEST_SCRIPT) # Add h5repack specific linker flags here h5repack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -469,7 +505,9 @@ COMMON_SOURCES = h5repack.c h5repack_copy.c h5repack_filters.c \ h5repack_SOURCES = $(COMMON_SOURCES) h5repack_main.c h5repacktst_SOURCES = $(COMMON_SOURCES) h5repacktst.c testh5repack_detect_szip_SOURCES = testh5repack_detect_szip.c -DISTCLEANFILES = h5repack.sh +@HAVE_SHARED_CONDITIONAL_TRUE@lib_LTLIBRARIES = libdynlibadd.la +@HAVE_SHARED_CONDITIONAL_TRUE@libdynlibadd_la_SOURCES = $(top_srcdir)/test/dynlib1.c +DISTCLEANFILES = h5repack.sh h5repack_plugin.sh # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -527,6 +565,44 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): h5repack.sh: $(top_builddir)/config.status $(srcdir)/h5repack.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +h5repack_plugin.sh: $(top_builddir)/config.status $(srcdir)/h5repack_plugin.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +libdynlibadd.la: $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_DEPENDENCIES) $(EXTRA_libdynlibadd_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libdynlibadd_la_rpath) $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -607,6 +683,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repack_copy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5repack_filters.Po@am__quote@ @@ -639,6 +716,13 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +dynlib1.lo: $(top_srcdir)/test/dynlib1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dynlib1.lo -MD -MP -MF $(DEPDIR)/dynlib1.Tpo -c -o dynlib1.lo `test -f '$(top_srcdir)/test/dynlib1.c' || echo '$(srcdir)/'`$(top_srcdir)/test/dynlib1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dynlib1.Tpo $(DEPDIR)/dynlib1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/test/dynlib1.c' object='dynlib1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dynlib1.lo `test -f '$(top_srcdir)/test/dynlib1.c' || echo '$(srcdir)/'`$(top_srcdir)/test/dynlib1.c + mostlyclean-libtool: -rm -f *.lo @@ -745,9 +829,11 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(PROGRAMS) all-local +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local +install-binPROGRAMS: install-libLTLIBRARIES + installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -781,10 +867,12 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@HAVE_SHARED_CONDITIONAL_FALSE@install-exec-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libtool clean-noinstPROGRAMS mostlyclean-am + clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -810,8 +898,9 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-binPROGRAMS - +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: @@ -850,25 +939,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES -.MAKE: check-am install-am install-strip +.MAKE: check-am install-am install-exec-am install-strip .PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ - clean-libtool clean-noinstPROGRAMS cscopelist ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ + clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ + cscopelist ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-exec-hook install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS + uninstall-binPROGRAMS uninstall-libLTLIBRARIES # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. @@ -885,6 +975,11 @@ help: # The h5repack.sh script needs h5repacktst to run first. h5repack.sh.chkexe_: h5repacktst.chkexe_ +@HAVE_SHARED_CONDITIONAL_TRUE@ # Build it as shared library if configure is enabled for shared library. + +@HAVE_SHARED_CONDITIONAL_TRUE@install-exec-hook: +@HAVE_SHARED_CONDITIONAL_TRUE@ $(RM) $(DESTDIR)$(libdir)/*dynlib* + # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 5d30bf2..c79fea7 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -1,17 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * -* the files COPYING and Copyright.html. COPYING can be found at the root * -* of the source code distribution tree; Copyright.html can be found at the * -* root level of an installed copy of the electronic HDF5 document set and * -* is linked from the top-level documents page. It can also be found at * -* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -* access to either file, you may request a copy from help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include @@ -23,224 +23,198 @@ #include "h5tools_utils.h" /*------------------------------------------------------------------------- -* File: h5repack.c -* Purpose: Public API functions -*------------------------------------------------------------------------- -*/ + * File: h5repack.c + * Purpose: Public API functions + *------------------------------------------------------------------------- + */ static int check_options(pack_opt_t *options); static int check_objects(const char* fname, pack_opt_t *options); -static const char* get_sfilter (H5Z_filter_t filtn); +static const char* get_sfilter(H5Z_filter_t filtn); static int have_request(pack_opt_t *options); - - /*------------------------------------------------------------------------- -* Function: h5repack -* -* Purpose: locate all high-level HDF5 objects in the file -* and compress/chunk them using options -* -* Algorithm: 2 traversals are made to the file; the 1st builds a list of -* the objects, the 2nd makes a copy of them, using the options; -* the reason for the 1st traversal is to check for invalid -* object name requests -* -* Return: 0, ok, -1, fail -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: September, 22, 2003 -* -*------------------------------------------------------------------------- -*/ -int h5repack(const char* infile, - const char* outfile, - pack_opt_t *options) -{ - /* check input */ - if (check_options(options)<0) - return -1; - - /* check for objects in input that are in the file */ - if (check_objects(infile,options) < 0) - return -1; - - /* copy the objects */ - if (copy_objects(infile,outfile,options) < 0) - return -1; - - - return 0; -} + * Function: h5repack + * + * Purpose: locate all high-level HDF5 objects in the file + * and compress/chunk them using options + * + * Algorithm: 2 traversals are made to the file; the 1st builds a list of + * the objects, the 2nd makes a copy of them, using the options; + * the reason for the 1st traversal is to check for invalid + * object name requests + * + * Return: 0, ok, -1, fail + * + * Programmer: pvn@ncsa.uiuc.edu + * + * Date: September, 22, 2003 + * + *------------------------------------------------------------------------- + */ +int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { + /* check input */ + if (check_options(options) < 0) + return -1; + /* check for objects in input that are in the file */ + if (check_objects(infile, options) < 0) + return -1; + /* copy the objects */ + if (copy_objects(infile, outfile, options) < 0) + return -1; -/*------------------------------------------------------------------------- -* Function: h5repack_init -* -* Purpose: initialize options -* -* Return: 0, ok, -1, fail -* -*------------------------------------------------------------------------- -*/ - -int -h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, - H5F_file_space_type_t strategy, hsize_t threshold) -{ - int k, n; - - HDmemset(options, 0, sizeof(pack_opt_t)); - options->min_comp = 0; - options->verbose = verbose; - options->latest = latest; - options->layout_g = H5D_LAYOUT_ERROR; - - for ( n = 0; n < H5_REPACK_MAX_NFILTERS; n++) - { - options->filter_g[n].filtn = -1; - options->filter_g[n].cd_nelmts = 0; - for ( k = 0; k < CD_VALUES; k++) - options->filter_g[n].cd_values[k] = 0; - } - - options->fs_strategy = strategy; - options->fs_threshold = threshold; - - return (options_table_init(&(options->op_tbl))); + return 0; } - /*------------------------------------------------------------------------- -* Function: h5repack_end -* -* Purpose: free options table -* -*------------------------------------------------------------------------- -*/ - -int h5repack_end (pack_opt_t *options) -{ - return options_table_free(options->op_tbl); + * Function: h5repack_init + * + * Purpose: initialize options + * + * Return: 0, ok, -1, fail + * + *------------------------------------------------------------------------- + */ +int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, + H5F_file_space_type_t strategy, hsize_t threshold) { + int k, n; + + HDmemset(options, 0, sizeof(pack_opt_t)); + options->min_comp = 0; + options->verbose = verbose; + options->latest = latest; + options->layout_g = H5D_LAYOUT_ERROR; + + for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { + options->filter_g[n].filtn = -1; + options->filter_g[n].cd_nelmts = 0; + for (k = 0; k < CD_VALUES; k++) + options->filter_g[n].cd_values[k] = 0; + } + + options->fs_strategy = strategy; + options->fs_threshold = threshold; + + return (options_table_init(&(options->op_tbl))); } - /*------------------------------------------------------------------------- -* Function: h5repack_addfilter -* -* Purpose: add a compression -f option to table -* Example: -f dset:GZIP=6 -* -* Return: 0, ok, -1, fail -* -*------------------------------------------------------------------------- -*/ -int h5repack_addfilter(const char* str, - pack_opt_t *options) -{ - obj_list_t *obj_list=NULL; /* one object list for the -f and -l option entry */ - filter_info_t filter; /* filter info for the current -f option entry */ - int n_objs; /* number of objects in the current -f or -l option entry */ - int is_glb; /* is the filter global */ - - - - /* parse the -f option */ - if(NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) - return -1; - - /* if it applies to all objects */ - if(is_glb) - { - int n; - - n = options->n_filter_g++; /* increase # of global filters */ - - if(options->n_filter_g > H5_REPACK_MAX_NFILTERS) - { - error_msg("maximum number of filters exceeded for <%s>\n", str); - HDfree(obj_list); - return -1; - } - - options->filter_g[n] = filter; - } - else - options_add_filter(obj_list, n_objs, filter, options->op_tbl); - - HDfree(obj_list); - return 0; + * Function: h5repack_end + * + * Purpose: free options table + * + *------------------------------------------------------------------------- + */ + +int h5repack_end(pack_opt_t *options) { + return options_table_free(options->op_tbl); } +/*------------------------------------------------------------------------- + * Function: h5repack_addfilter + * + * Purpose: add a compression -f option to table + * Example: -f dset:GZIP=6 + * + * Return: 0, ok, -1, fail + * + *------------------------------------------------------------------------- + */ +int h5repack_addfilter(const char* str, pack_opt_t *options) { + obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */ + filter_info_t filter; /* filter info for the current -f option entry */ + int n_objs; /* number of objects in the current -f or -l option entry */ + int is_glb; /* is the filter global */ + + /* parse the -f option */ + if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) + return -1; + + /* if it applies to all objects */ + if (is_glb) { + int n; + + n = options->n_filter_g++; /* increase # of global filters */ + + if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { + error_msg("maximum number of filters exceeded for <%s>\n", str); + HDfree(obj_list); + return -1; + } + + options->filter_g[n] = filter; + } + else + options_add_filter(obj_list, n_objs, filter, options->op_tbl); + + HDfree(obj_list); + return 0; +} /*------------------------------------------------------------------------- -* Function: h5repack_addlayout -* -* Purpose: add a layout option -* -* Return: 0, ok, -1, fail -* -*------------------------------------------------------------------------- -*/ - - -int h5repack_addlayout(const char* str, - pack_opt_t *options) -{ - - obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */ - int n_objs; /*number of objects in the current -t or -c option entry */ - pack_info_t pack; /*info about layout to extract from parse */ - int j; - - init_packobject(&pack); - - if (options->all_layout==1){ - error_msg("invalid layout input: 'all' option \ - is present with other objects <%s>\n",str); - return -1; - } - - /* parse the layout option */ - obj_list=parse_layout(str,&n_objs,&pack,options); - if (obj_list==NULL) - return -1; - - /* set layout option */ - options->layout_g = pack.layout; - - /* no individual dataset specified */ - if (options->all_layout==1 ) - { - if (pack.layout==H5D_CHUNKED) - { - /* -2 means the NONE option, remove chunking - and set the global layout to contiguous */ - if (pack.chunk.rank==-2) - { - options->layout_g = H5D_CONTIGUOUS; - } - /* otherwise set the global chunking type */ - else - { - options->chunk_g.rank=pack.chunk.rank; - for (j = 0; j < pack.chunk.rank; j++) - options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j]; - } - } - } - - /* individual dataset specified */ - if (options->all_layout==0) - options_add_layout(obj_list, - n_objs, - &pack, - options->op_tbl); - - HDfree(obj_list); - return 0; + * Function: h5repack_addlayout + * + * Purpose: add a layout option + * + * Return: 0, ok, -1, fail + * + *------------------------------------------------------------------------- + */ + +int h5repack_addlayout(const char* str, pack_opt_t *options) { + + obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */ + int n_objs; /*number of objects in the current -t or -c option entry */ + pack_info_t pack; /*info about layout to extract from parse */ + int j; + int ret_value = -1; + + init_packobject(&pack); + + if (options->all_layout == 1) { + error_msg( + "invalid layout input: 'all' option \ + is present with other objects <%s>\n", + str); + return ret_value; + } + + /* parse the layout option */ + obj_list = parse_layout(str, &n_objs, &pack, options); + if (obj_list) { + + /* set layout option */ + options->layout_g = pack.layout; + + /* no individual dataset specified */ + if (options->all_layout == 1) { + if (pack.layout == H5D_CHUNKED) { + /* -2 means the NONE option, remove chunking + and set the global layout to contiguous */ + if (pack.chunk.rank == -2) { + options->layout_g = H5D_CONTIGUOUS; + } + /* otherwise set the global chunking type */ + else { + options->chunk_g.rank = pack.chunk.rank; + for (j = 0; j < pack.chunk.rank; j++) + options->chunk_g.chunk_lengths[j] = + pack.chunk.chunk_lengths[j]; + } + } + } + + /* individual dataset specified */ + if (options->all_layout == 0) + ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); + + HDfree(obj_list); + ret_value = 0; + } + + return ret_value; } /* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr() @@ -250,766 +224,720 @@ int h5repack_addlayout(const char* str, * others to static in h5repack_copy.c. */ /*------------------------------------------------------------------------- -* Function: copy_named_datatype -* -* Purpose: Copies the specified datatype anonymously, and returns an open -* id for that datatype in the output file. The first time this -* is called it scans every named datatype in travt into a -* private stack, afterwards it simply scans that stack. The id -* returned must be closed after it is no longer needed. -* named_datatype_free must be called before the program exits -* to free the stack. -* -* Programmer: Neil Fortner -* -* Date: April 14, 2009 -* -*------------------------------------------------------------------------- -*/ -hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) -{ - named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ - named_dt_t *dt_ret = NULL; /* Datatype to return */ - H5O_info_t oinfo; /* Object info of input dtype */ - hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ - - if(H5Oget_info(type_in, &oinfo) < 0) - goto error; - - if(*named_dt_head_p) - { - /* Stack already exists, search for the datatype */ - while(dt && dt->addr_in != oinfo.addr) - dt = dt->next; - - dt_ret = dt; - } - else - { - /* Create the stack */ - size_t i; - - for(i=0; inobjs; i++) - if(travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) - { - /* Push onto the stack */ - if(NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) - goto error; - dt->next = *named_dt_head_p; - *named_dt_head_p = dt; - - /* Update the address and id */ - dt->addr_in = travt->objs[i].objno; - dt->id_out = -1; - - /* Check if this type is the one requested */ - if(oinfo.addr == dt->addr_in) - { - HDassert(!dt_ret); - dt_ret = dt; - } /* end if */ - } /* end if */ - } /* end else */ - - /* Handle the case that the requested datatype was not found. This is - * possible if the datatype was committed anonymously in the input file. */ - if(!dt_ret) - { - /* Push the new datatype onto the stack */ - if(NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) - goto error; - dt_ret->next = *named_dt_head_p; - *named_dt_head_p = dt_ret; - - /* Update the address and id */ - dt_ret->addr_in = oinfo.addr; - dt_ret->id_out = -1; - } /* end if */ - - /* If the requested datatype does not yet exist in the output file, copy it - * anonymously */ - if(dt_ret->id_out < 0) - { - if (options->use_native==1) - dt_ret->id_out = h5tools_get_native_type(type_in); - else - dt_ret->id_out = H5Tcopy(type_in); - if(dt_ret->id_out < 0) - goto error; - if(H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; - } /* end if */ - - /* Set return value */ - ret_value = dt_ret->id_out; - - /* Increment the ref count on id_out, because the calling function will try - * to close it */ - if(H5Iinc_ref(ret_value) < 0) - goto error; - - return(ret_value); - -error: - return(-1); + * Function: copy_named_datatype + * + * Purpose: Copies the specified datatype anonymously, and returns an open + * id for that datatype in the output file. The first time this + * is called it scans every named datatype in travt into a + * private stack, afterwards it simply scans that stack. The id + * returned must be closed after it is no longer needed. + * named_datatype_free must be called before the program exits + * to free the stack. + * + * Programmer: Neil Fortner + * + * Date: April 14, 2009 + * + *------------------------------------------------------------------------- + */ +hid_t copy_named_datatype(hid_t type_in, hid_t fidout, + named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { + named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ + named_dt_t *dt_ret = NULL; /* Datatype to return */ + H5O_info_t oinfo; /* Object info of input dtype */ + hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ + + if (H5Oget_info(type_in, &oinfo) < 0) + goto done; + + if (*named_dt_head_p) { + /* Stack already exists, search for the datatype */ + while (dt && dt->addr_in != oinfo.addr) + dt = dt->next; + + dt_ret = dt; + } + else { + /* Create the stack */ + size_t i; + + for (i = 0; i < travt->nobjs; i++) { + if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { + /* Push onto the stack */ + if (NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) { + goto done; + } + dt->next = *named_dt_head_p; + *named_dt_head_p = dt; + + /* Update the address and id */ + dt->addr_in = travt->objs[i].objno; + dt->id_out = -1; + + /* Check if this type is the one requested */ + if (oinfo.addr == dt->addr_in) { + HDassert(!dt_ret); + dt_ret = dt; + } /* end if */ + } /* end if */ + } /* end for */ + } /* end else */ + + /* Handle the case that the requested datatype was not found. This is + * possible if the datatype was committed anonymously in the input file. */ + if (!dt_ret) { + /* Push the new datatype onto the stack */ + if (NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) { + goto done; + } + dt_ret->next = *named_dt_head_p; + *named_dt_head_p = dt_ret; + + /* Update the address and id */ + dt_ret->addr_in = oinfo.addr; + dt_ret->id_out = -1; + } /* end if */ + + /* If the requested datatype does not yet exist in the output file, copy it + * anonymously */ + if (dt_ret->id_out < 0) { + if (options->use_native == 1) + dt_ret->id_out = h5tools_get_native_type(type_in); + else + dt_ret->id_out = H5Tcopy(type_in); + if (dt_ret->id_out < 0) + goto done; + if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto done; + } /* end if */ + + /* Set return value */ + ret_value = dt_ret->id_out; + + /* Increment the ref count on id_out, because the calling function will try + * to close it */ + if(H5Iinc_ref(ret_value) < 0) { + ret_value = -1; + } + +done: + return (ret_value); } /* end copy_named_datatype */ - /*------------------------------------------------------------------------- -* Function: named_datatype_free -* -* Purpose: Frees the stack of named datatypes. -* -* Programmer: Neil Fortner -* -* Date: April 14, 2009 -* -*------------------------------------------------------------------------- -*/ -int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) -{ - named_dt_t *dt = *named_dt_head_p; - - while(dt) - { - /* Pop the datatype off the stack and free it */ - if(H5Tclose(dt->id_out) < 0 && !ignore_err) - goto error; - dt = dt->next; - HDfree(*named_dt_head_p); - *named_dt_head_p = dt; - } /* end while */ - - return 0; - -error: - return -1; + * Function: named_datatype_free + * + * Purpose: Frees the stack of named datatypes. + * + * Programmer: Neil Fortner + * + * Date: April 14, 2009 + * + *------------------------------------------------------------------------- + */ +int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { + named_dt_t *dt = *named_dt_head_p; + hid_t ret_value = -1; + + while (dt) { + /* Pop the datatype off the stack and free it */ + if (H5Tclose(dt->id_out) < 0 && !ignore_err) + goto done; + dt = dt->next; + HDfree(*named_dt_head_p); + *named_dt_head_p = dt; + } /* end while */ + + ret_value = 0; + +done: + return (ret_value); } /* end named_datatype_free */ /*------------------------------------------------------------------------- -* Function: copy_attr -* -* Purpose: copy attributes located in LOC_IN, which is obtained either from -* loc_id = H5Gopen2( fid, name); -* loc_id = H5Dopen2( fid, name); -* loc_id = H5Topen2( fid, name); -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: October, 28, 2003 -* -*------------------------------------------------------------------------- -*/ -int copy_attr(hid_t loc_in, - hid_t loc_out, - named_dt_t **named_dt_head_p, - trav_table_t *travt, - pack_opt_t *options) -{ - hid_t attr_id=-1; /* attr ID */ - hid_t attr_out=-1; /* attr ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file type ID */ - hid_t wtype_id=-1; /* read/write type ID */ - size_t msize; /* size of type */ - void *buf = NULL; /* data buffer */ - hsize_t nelmts; /* number of elements in dataset */ - int rank; /* rank of dataset */ - htri_t is_named; /* Whether the datatype is named */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - char name[255]; - H5O_info_t oinfo; /* object info */ - int j; - unsigned u; - hbool_t is_ref=0; - H5T_class_t type_class = -1; - - if(H5Oget_info(loc_in, &oinfo) < 0) - goto error; - - /*------------------------------------------------------------------------- - * copy all attributes - *------------------------------------------------------------------------- - */ - for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { - /* open attribute */ - if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - - /* get name */ - if(H5Aget_name(attr_id, (size_t)255, name) < 0) - goto error; - - /* get the file datatype */ - if((ftype_id = H5Aget_type(attr_id)) < 0 ) - goto error; - - /* Check if the datatype is committed */ - if((is_named = H5Tcommitted(ftype_id)) < 0) - goto error; - if(is_named && travt) { - hid_t fidout; - - /* Create out file id */ - if((fidout = H5Iget_file_id(loc_out)) < 0) - goto error; - - /* Copy named dt */ - if((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, - travt, options)) < 0) - { - H5Fclose(fidout); - goto error; - } /* end if */ - - if(H5Fclose(fidout) < 0) - goto error; - } /* end if */ - else { - if(options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end else */ - - - /* get the dataspace handle */ - if((space_id = H5Aget_space(attr_id)) < 0) - goto error; - - /* get dimensions */ - if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - goto error; - - nelmts = 1; - for(j = 0; j < rank; j++) - nelmts *= dims[j]; - - if((msize = H5Tget_size(wtype_id)) == 0) - goto error; - - /*------------------------------------------------------------------------- - * object references are a special case. We cannot just copy the buffers, - * but instead we recreate the reference. - * This is done on a second sweep of the file that just copies the referenced - * objects at copy_refs_attr() - *------------------------------------------------------------------------- - */ - type_class = H5Tget_class(wtype_id); - is_ref = (type_class == H5T_REFERENCE); - if (type_class == H5T_VLEN ||type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); - H5Tclose(base_type); - } - - if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(wtype_id) ; - for (j=0; jverbose) - printf(FORMAT_OBJ_ATTR, "attr", name); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if(H5Tclose(ftype_id) < 0) - goto error; - if(H5Tclose(wtype_id) < 0) - goto error; - if(H5Sclose(space_id) < 0) - goto error; - if(H5Aclose(attr_id) < 0) - goto error; - } /* u */ - - return 0; + * Function: copy_attr + * + * Purpose: copy attributes located in LOC_IN, which is obtained either from + * loc_id = H5Gopen2( fid, name); + * loc_id = H5Dopen2( fid, name); + * loc_id = H5Topen2( fid, name); + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: October, 28, 2003 + * + *------------------------------------------------------------------------- + */ +int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, + trav_table_t *travt, pack_opt_t *options) { + hid_t attr_id = -1; /* attr ID */ + hid_t attr_out = -1; /* attr ID */ + hid_t space_id = -1; /* space ID */ + hid_t ftype_id = -1; /* file type ID */ + hid_t wtype_id = -1; /* read/write type ID */ + size_t msize; /* size of type */ + void *buf = NULL; /* data buffer */ + hsize_t nelmts; /* number of elements in dataset */ + int rank; /* rank of dataset */ + htri_t is_named; /* Whether the datatype is named */ + hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ + char name[255]; + H5O_info_t oinfo; /* object info */ + int j; + unsigned u; + hbool_t is_ref = 0; + H5T_class_t type_class = -1; + + if (H5Oget_info(loc_in, &oinfo) < 0) + goto error; + + /*------------------------------------------------------------------------- + * copy all attributes + *------------------------------------------------------------------------- + */ + for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { + /* open attribute */ + if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, + H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* get name */ + if (H5Aget_name(attr_id, (size_t) 255, name) < 0) + goto error; + + /* get the file datatype */ + if ((ftype_id = H5Aget_type(attr_id)) < 0) + goto error; + + /* Check if the datatype is committed */ + if ((is_named = H5Tcommitted(ftype_id)) < 0) + goto error; + if (is_named && travt) { + hid_t fidout; + + /* Create out file id */ + if ((fidout = H5Iget_file_id(loc_out)) < 0) + goto error; + + /* Copy named dt */ + if ((wtype_id = copy_named_datatype(ftype_id, fidout, + named_dt_head_p, travt, options)) < 0) { + H5Fclose(fidout); + goto error; + } /* end if */ + + if (H5Fclose(fidout) < 0) + goto error; + } /* end if */ + else { + if (options->use_native == 1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end else */ + + /* get the dataspace handle */ + if ((space_id = H5Aget_space(attr_id)) < 0) + goto error; + + /* get dimensions */ + if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) + goto error; + + nelmts = 1; + for (j = 0; j < rank; j++) + nelmts *= dims[j]; + + if ((msize = H5Tget_size(wtype_id)) == 0) + goto error; + + /*------------------------------------------------------------------------- + * object references are a special case. We cannot just copy the buffers, + * but instead we recreate the reference. + * This is done on a second sweep of the file that just copies the referenced + * objects at copy_refs_attr() + *------------------------------------------------------------------------- + */ + type_class = H5Tget_class(wtype_id); + is_ref = (type_class == H5T_REFERENCE); + if (type_class == H5T_VLEN || type_class == H5T_ARRAY) { + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); + H5Tclose(base_type); + } + + if (type_class == H5T_COMPOUND) { + int nmembers = H5Tget_nmembers(wtype_id); + for (j = 0; j < nmembers; j++) { + hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j); + H5T_class_t mtclass = H5Tget_class(mtid); + H5Tclose(mtid); + + if (mtclass == H5T_REFERENCE) { + is_ref = 1; + break; + } + } /* for (j=0; iverbose) + printf(FORMAT_OBJ_ATTR, "attr", name); + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + if (H5Tclose(ftype_id) < 0) + goto error; + if (H5Tclose(wtype_id) < 0) + goto error; + if (H5Sclose(space_id) < 0) + goto error; + if (H5Aclose(attr_id) < 0) + goto error; + } /* u */ + + return 0; error: - H5E_BEGIN_TRY { - if(buf) { - /* Check if we have VL data and string in the attribute's datatype that must - * be reclaimed */ - if (TRUE == h5tools_detect_vlen(wtype_id)) - H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); - - /* Free buf */ - HDfree(buf); - } /* end if */ - - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Sclose(space_id); - H5Aclose(attr_id); - H5Aclose(attr_out); - } H5E_END_TRY; - - return -1; + H5E_BEGIN_TRY + { + if (buf) { + /* Check if we have VL data and string in the attribute's datatype that must + * be reclaimed */ + if (TRUE == h5tools_detect_vlen(wtype_id)) + H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); + + /* Free buf */ + HDfree(buf); + } /* end if */ + + H5Tclose(ftype_id); + H5Tclose(wtype_id); + H5Sclose(space_id); + H5Aclose(attr_id); + H5Aclose(attr_out); + } H5E_END_TRY; + + return -1; } /* end copy_attr() */ /*------------------------------------------------------------------------- -* Function: check_options -* -* Purpose: print options, checks for invalid options -* -* Return: void, return -1 on error -* -* Programmer: pvn@ncsa.uiuc.edu -* -* Date: September, 22, 2003 -* -* Modification: -* Peter Cao, July 9, 2007 -* Add "-L, --latest" and other options to pack a file with the latest file format -* -*------------------------------------------------------------------------- -*/ -static int check_options(pack_opt_t *options) -{ - unsigned int i; - int k, j, has_cp=0, has_ck=0; - char slayout[30]; - - /*------------------------------------------------------------------------- - * objects to layout - *------------------------------------------------------------------------- - */ - if (options->verbose && have_request(options) /* only print if requested */) - { - printf("Objects to modify layout are...\n"); - if (options->all_layout==1) - { - switch (options->layout_g) - { - case H5D_COMPACT: - strcpy(slayout,"compact"); - break; - case H5D_CONTIGUOUS: - strcpy(slayout,"contiguous"); - break; - case H5D_CHUNKED: - strcpy(slayout,"chunked"); - break; - case H5D_LAYOUT_ERROR: - case H5D_NLAYOUTS: - error_msg("invalid layout\n"); - return -1; - default: - strcpy(slayout,"invalid layout\n"); - return -1; - } - printf(" Apply %s layout to all\n", slayout); - if (H5D_CHUNKED==options->layout_g) - { - printf("with dimension ["); - for ( j = 0; j < options->chunk_g.rank; j++) - printf("%d ",(int)options->chunk_g.chunk_lengths[j]); - printf("]\n"); - } - } - }/* verbose */ - - for ( i = 0; i < options->op_tbl->nelems; i++) - { - char* name=options->op_tbl->objs[i].path; - - if (options->op_tbl->objs[i].chunk.rank>0) - { - if (options->verbose){ - printf(" <%s> with chunk size ",name); - for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - printf("%d ",(int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); - printf("\n"); - } - has_ck=1; - } - else if (options->op_tbl->objs[i].chunk.rank==-2) - { - if (options->verbose) - printf(" <%s> %s\n",name,"NONE (contigous)"); - has_ck=1; - } - } - - if (options->all_layout==1 && has_ck) - { - error_msg("invalid chunking input: 'all' option\ + * Function: check_options + * + * Purpose: print options, checks for invalid options + * + * Return: void, return -1 on error + * + * Programmer: pvn@ncsa.uiuc.edu + * + * Date: September, 22, 2003 + * + * Modification: + * Peter Cao, July 9, 2007 + * Add "-L, --latest" and other options to pack a file with the latest file format + * + *------------------------------------------------------------------------- + */ +static int check_options(pack_opt_t *options) { + unsigned int i; + int k, j, has_cp = 0, has_ck = 0; + char slayout[30]; + + /*------------------------------------------------------------------------- + * objects to layout + *------------------------------------------------------------------------- + */ + if (options->verbose && have_request(options) /* only print if requested */) { + printf("Objects to modify layout are...\n"); + if (options->all_layout == 1) { + switch (options->layout_g) { + case H5D_COMPACT: + strcpy(slayout, "compact"); + break; + case H5D_CONTIGUOUS: + strcpy(slayout, "contiguous"); + break; + case H5D_CHUNKED: + strcpy(slayout, "chunked"); + break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + error_msg("invalid layout\n"); + return -1; + default: + strcpy(slayout, "invalid layout\n"); + return -1; + } + printf(" Apply %s layout to all\n", slayout); + if (H5D_CHUNKED == options->layout_g) { + printf("with dimension ["); + for (j = 0; j < options->chunk_g.rank; j++) + printf("%d ", (int) options->chunk_g.chunk_lengths[j]); + printf("]\n"); + } + } + }/* verbose */ + + for (i = 0; i < options->op_tbl->nelems; i++) { + char* name = options->op_tbl->objs[i].path; + + if (options->op_tbl->objs[i].chunk.rank > 0) { + if (options->verbose) { + printf(" <%s> with chunk size ", name); + for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) + printf("%d ", + (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); + printf("\n"); + } + has_ck = 1; + } + else if (options->op_tbl->objs[i].chunk.rank == -2) { + if (options->verbose) + printf(" <%s> %s\n", name, "NONE (contigous)"); + has_ck = 1; + } + } + + if (options->all_layout == 1 && has_ck) { + error_msg( + "invalid chunking input: 'all' option\ is present with other objects\n"); - return -1; - } - - /*------------------------------------------------------------------------- - * objects to filter - *------------------------------------------------------------------------- - */ - - if (options->verbose && have_request(options) /* only print if requested */) - { - printf("Objects to apply filter are...\n"); - if (options->all_filter==1) - { - - for (k = 0; k < options->n_filter_g; k++ ) - { - H5Z_filter_t filtn=options->filter_g[k].filtn; - switch (filtn) - { - case H5Z_FILTER_NONE: - printf(" Uncompress all\n"); - break; - case H5Z_FILTER_SHUFFLE: - case H5Z_FILTER_FLETCHER32: - printf(" All with %s\n",get_sfilter(filtn)); - break; - case H5Z_FILTER_SZIP: - case H5Z_FILTER_DEFLATE: - printf(" All with %s, parameter %d\n", - get_sfilter(filtn), - options->filter_g[k].cd_values[0]); - break; - default: - break; - } /* k */ - }; - } - } /* verbose */ - - for ( i = 0; i < options->op_tbl->nelems; i++) - { - pack_info_t pack = options->op_tbl->objs[i]; - char* name = pack.path; - - for ( j=0; jverbose) - { - printf(" <%s> with %s filter\n", - name, - get_sfilter(pack.filter[j].filtn)); - } - - has_cp=1; - - } /* j */ - } /* i */ - - if (options->all_filter==1 && has_cp) - { - error_msg("invalid compression input: 'all' option\ + return -1; + } + + /*------------------------------------------------------------------------- + * objects to filter + *------------------------------------------------------------------------- + */ + + if (options->verbose && have_request(options) /* only print if requested */) { + printf("Objects to apply filter are...\n"); + if (options->all_filter == 1) { + for (k = 0; k < options->n_filter_g; k++) { + H5Z_filter_t filtn = options->filter_g[k].filtn; + switch (filtn) { + case H5Z_FILTER_NONE: + printf(" Uncompress all\n"); + break; + case H5Z_FILTER_SHUFFLE: + case H5Z_FILTER_FLETCHER32: + printf(" All with %s\n", get_sfilter(filtn)); + break; + case H5Z_FILTER_SZIP: + case H5Z_FILTER_DEFLATE: + printf(" All with %s, parameter %d\n", get_sfilter(filtn), + options->filter_g[k].cd_values[0]); + break; + default: + printf(" User Defined %d\n", filtn); + break; + } /* k */ + }; + } + } /* verbose */ + + for (i = 0; i < options->op_tbl->nelems; i++) { + pack_info_t pack = options->op_tbl->objs[i]; + char* name = pack.path; + + for (j = 0; j < pack.nfilters; j++) { + if (options->verbose) { + printf(" <%s> with %s filter\n", name, + get_sfilter(pack.filter[j].filtn)); + } + + has_cp = 1; + + } /* j */ + } /* i */ + + if (options->all_filter == 1 && has_cp) { + error_msg( + "invalid compression input: 'all' option\ is present with other objects\n"); - return -1; - } - - /*------------------------------------------------------------------------- - * check options for the latest format - *------------------------------------------------------------------------- - */ - - if (options->grp_compact < 0) - { - error_msg("invalid maximum number of links to store as header messages\n"); - return -1; - } - if (options->grp_indexed < 0) - { - error_msg("invalid minimum number of links to store in the indexed format\n"); - return -1; - } - if (options->grp_indexed > options->grp_compact) - { - error_msg("minimum indexed size is greater than the maximum compact size\n"); - return -1; - } - for (i=0; i<8; i++) - { - if (options->msg_size[i]<0) - { - error_msg("invalid shared message size\n"); - return -1; - } - } - - - /*-------------------------------------------------------------------------------- - * verify new user userblock options; file name must be present - *--------------------------------------------------------------------------------- - */ - if ( options->ublock_filename != NULL && options->ublock_size == 0 ) - { - if ( options->verbose ) - { - printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", - options->ublock_filename); - options->ublock_size = 1024; - } - } - - if ( options->ublock_filename == NULL && options->ublock_size != 0 ) - { - error_msg("file name missing for user block\n", - options->ublock_filename); - return -1; - } - - - /*-------------------------------------------------------------------------------- - * verify alignment options; threshold is zero default but alignment not - *--------------------------------------------------------------------------------- - */ - - if ( options->alignment == 0 && options->threshold != 0 ) - { - error_msg("alignment for H5Pset_alignment missing\n"); - return -1; - } - - return 0; + return -1; + } + + /*------------------------------------------------------------------------- + * check options for the latest format + *------------------------------------------------------------------------- + */ + + if (options->grp_compact < 0) { + error_msg( + "invalid maximum number of links to store as header messages\n"); + return -1; + } + if (options->grp_indexed < 0) { + error_msg( + "invalid minimum number of links to store in the indexed format\n"); + return -1; + } + if (options->grp_indexed > options->grp_compact) { + error_msg( + "minimum indexed size is greater than the maximum compact size\n"); + return -1; + } + for (i = 0; i < 8; i++) { + if (options->msg_size[i] < 0) { + error_msg("invalid shared message size\n"); + return -1; + } + } + + /*-------------------------------------------------------------------------------- + * verify new user userblock options; file name must be present + *--------------------------------------------------------------------------------- + */ + if (options->ublock_filename != NULL && options->ublock_size == 0) { + if (options->verbose) { + printf( + "Warning: user block size missing for file %s. Assigning a default size of 1024...\n", + options->ublock_filename); + options->ublock_size = 1024; + } + } + + if (options->ublock_filename == NULL && options->ublock_size != 0) { + error_msg("file name missing for user block\n", + options->ublock_filename); + return -1; + } + + /*-------------------------------------------------------------------------------- + * verify alignment options; threshold is zero default but alignment not + *--------------------------------------------------------------------------------- + */ + + if (options->alignment == 0 && options->threshold != 0) { + error_msg("alignment for H5Pset_alignment missing\n"); + return -1; + } + + return 0; } - /*------------------------------------------------------------------------- -* Function: check_objects -* -* Purpose: locate all HDF5 objects in the file and compare with user -* supplied list -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: September, 23, 2003 -* -*------------------------------------------------------------------------- -*/ -static int check_objects(const char* fname, - pack_opt_t *options) -{ - hid_t fid; - unsigned int i; - trav_table_t *travt = NULL; - - /* nothing to do */ - if(options->op_tbl->nelems == 0) - return 0; - - /*------------------------------------------------------------------------- - * open the file - *------------------------------------------------------------------------- - */ - if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) - { - printf("<%s>: %s\n", fname, H5FOPENERROR ); - return -1; - } - - /*------------------------------------------------------------------------- - * get the list of objects in the file - *------------------------------------------------------------------------- - */ - - /* init table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if(h5trav_gettable(fid, travt) < 0) - goto out; - - /*------------------------------------------------------------------------- - * compare with user supplied list - *------------------------------------------------------------------------- - */ - - if(options->verbose) - printf("Opening file <%s>. Searching for objects to modify...\n", fname); - - for(i = 0; i < options->op_tbl->nelems; i++) - { - char* name=options->op_tbl->objs[i].path; - if(options->verbose) - printf(" <%s>",name); - - /* the input object names are present in the file and are valid */ - if(h5trav_getindext(name, travt) < 0) - { - error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", - (options->verbose?"\n":""),name,fname); - goto out; - } - if(options->verbose) - printf("...Found\n"); - - /* check for extra filter conditions */ - switch(options->op_tbl->objs[i].filter->filtn) - { - /* chunk size must be smaller than pixels per block */ - case H5Z_FILTER_SZIP: - { - int j; - hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0]; - hsize_t dims[H5S_MAX_RANK]; - int rank; - hid_t did; - hid_t sid; - - if(options->op_tbl->objs[i].chunk.rank > 0) { - rank = options->op_tbl->objs[i].chunk.rank; - for(j = 0; j < rank; j++) - csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; - } - else { - if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - goto out; - if((sid = H5Dget_space(did)) < 0) - goto out; - if((rank = H5Sget_simple_extent_ndims(sid)) < 0) - goto out; - HDmemset(dims, 0, sizeof dims); - if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - goto out; - for(j = 0; j < rank; j++) - csize *= dims[j]; - if(H5Sclose(sid) < 0) - goto out; - if(H5Dclose(did) < 0) - goto out; - } - - if (csize < ppb ) { - printf(" \n"); - goto out; - } - } - break; - default: - break; - } - } /* i */ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - H5Fclose(fid); - trav_table_free(travt); - return 0; + * Function: check_objects + * + * Purpose: locate all HDF5 objects in the file and compare with user + * supplied list + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: September, 23, 2003 + * + *------------------------------------------------------------------------- + */ +static int check_objects(const char* fname, pack_opt_t *options) { + hid_t fid; + unsigned int i; + trav_table_t *travt = NULL; + + /* nothing to do */ + if (options->op_tbl->nelems == 0) + return 0; + + /*------------------------------------------------------------------------- + * open the file + *------------------------------------------------------------------------- + */ + if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) + < 0) { + printf("<%s>: %s\n", fname, H5FOPENERROR); + return -1; + } + + /*------------------------------------------------------------------------- + * get the list of objects in the file + *------------------------------------------------------------------------- + */ + + /* init table */ + trav_table_init(&travt); + + /* get the list of objects in the file */ + if (h5trav_gettable(fid, travt) < 0) + goto out; + + /*------------------------------------------------------------------------- + * compare with user supplied list + *------------------------------------------------------------------------- + */ + + if (options->verbose) + printf("Opening file <%s>. Searching for objects to modify...\n", + fname); + + for (i = 0; i < options->op_tbl->nelems; i++) { + char* name = options->op_tbl->objs[i].path; + if (options->verbose) + printf(" <%s>", name); + + /* the input object names are present in the file and are valid */ + if (h5trav_getindext(name, travt) < 0) { + error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", + (options->verbose ? "\n" : ""), name, fname); + goto out; + } + if (options->verbose) + printf("...Found\n"); + + /* check for extra filter conditions */ + switch (options->op_tbl->objs[i].filter->filtn) { + /* chunk size must be smaller than pixels per block */ + case H5Z_FILTER_SZIP: + { + int j; + hsize_t csize = 1; + unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0]; + hsize_t dims[H5S_MAX_RANK]; + int rank; + hid_t did; + hid_t sid; + + if (options->op_tbl->objs[i].chunk.rank > 0) { + rank = options->op_tbl->objs[i].chunk.rank; + for (j = 0; j < rank; j++) + csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j]; + } + else { + if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) + goto out; + if ((sid = H5Dget_space(did)) < 0) + goto out; + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) + goto out; + HDmemset(dims, 0, sizeof dims); + if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) + goto out; + for (j = 0; j < rank; j++) + csize *= dims[j]; + if (H5Sclose(sid) < 0) + goto out; + if (H5Dclose(did) < 0) + goto out; + } + + if (csize < ppb) { + printf( + " \n"); + goto out; + } + } + break; + default: + break; + } + } /* i */ + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + H5Fclose(fid); + trav_table_free(travt); + return 0; out: - H5Fclose(fid); - trav_table_free(travt); - return -1; + H5Fclose(fid); + trav_table_free(travt); + return -1; } +/*------------------------------------------------------------------------- + * Function: have_request + * + * Purpose: check if a filter or layout was requested + * + * Return: 1 yes, 0 no + * + * Date: May, 24, 2007 + * + *------------------------------------------------------------------------- + */ +static int have_request(pack_opt_t *options) { + if (options->all_filter || options->all_layout || options->op_tbl->nelems) + return 1; - - -/*------------------------------------------------------------------------- -* Function: have_request -* -* Purpose: check if a filter or layout was requested -* -* Return: 1 yes, 0 no -* -* Date: May, 24, 2007 -* -*------------------------------------------------------------------------- -*/ -static int have_request(pack_opt_t *options) -{ - - if (options->all_filter || options->all_layout || options->op_tbl->nelems) - return 1; - - return 0; + return 0; } - /*------------------------------------------------------------------------- -* Function: get_sfilter -* -* Purpose: return the filter as a string name -* -* Return: name of filter, exit on error -* -*------------------------------------------------------------------------- -*/ - -static const char* get_sfilter(H5Z_filter_t filtn) -{ - if (filtn==H5Z_FILTER_NONE) - return "NONE"; - else if (filtn==H5Z_FILTER_DEFLATE) - return "GZIP"; - else if (filtn==H5Z_FILTER_SZIP) - return "SZIP"; - else if (filtn==H5Z_FILTER_SHUFFLE) - return "SHUFFLE"; - else if (filtn==H5Z_FILTER_FLETCHER32) - return "FLETCHER32"; - else if (filtn==H5Z_FILTER_NBIT) - return "NBIT"; - else if (filtn==H5Z_FILTER_SCALEOFFSET) - return "SOFF"; - else { - error_msg("input error in filter type\n"); - HDexit(EXIT_FAILURE); - } + * Function: get_sfilter + * + * Purpose: return the filter as a string name + * + * Return: name of filter, exit on error + * + *------------------------------------------------------------------------- + */ + +static const char* get_sfilter(H5Z_filter_t filtn) { + if (filtn == H5Z_FILTER_NONE) + return "NONE"; + else if (filtn == H5Z_FILTER_DEFLATE) + return "GZIP"; + else if (filtn == H5Z_FILTER_SZIP) + return "SZIP"; + else if (filtn == H5Z_FILTER_SHUFFLE) + return "SHUFFLE"; + else if (filtn == H5Z_FILTER_FLETCHER32) + return "FLETCHER32"; + else if (filtn == H5Z_FILTER_NBIT) + return "NBIT"; + else if (filtn == H5Z_FILTER_SCALEOFFSET) + return "SOFF"; + else + return "UD"; } diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 42b8ecb..583b6ef 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -117,11 +117,15 @@ $SRC_TOOLS_TESTFILES/tfamily00010.h5 " LIST_OTHER_TEST_FILES=" +$SRC_H5REPACK_TESTFILES/h5repack-help.txt $SRC_H5REPACK_TESTFILES/h5repack_ext.bin $SRC_H5REPACK_TESTFILES/ublock.bin $SRC_H5REPACK_TESTFILES/h5repack.info +$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl $SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl -$SRC_TOOLS_TESTFILES/h5repack_filters.h5.ddl +$SRC_H5REPACK_TESTFILES/h5repack_filters.h5.tst +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl +$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst " # @@ -436,7 +440,7 @@ TOOLTEST1() # TOOLTESTV() { - expect="$TESTDIR/$2.ddl" + expect="$TESTDIR/$2.tst" actual="$TESTDIR/`basename $2 .ddl`.out" actual_err="$TESTDIR/`basename $2 .ddl`.err" @@ -468,7 +472,7 @@ TOOLTESTV() echo " PASSED" else echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" + echo " Expected result (*.tst) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' fi @@ -484,7 +488,7 @@ TOOLTEST_DUMP() { infile=$TESTDIR/$2 outfile=$TESTDIR/out-$1.$2 - expect="$TESTDIR/$2.ddl" + expect="$TESTDIR/$1.$2.ddl" actual="$TESTDIR/out-$1.$2.out" actual_err="$TESTDIR/out-$1.$2.err" @@ -592,6 +596,40 @@ TOOLTEST_META() rm -f $outfile } +# ADD_HELP_TEST +TOOLTEST_HELP() { + + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .txt`.out" + actual_err="$TESTDIR/`basename $1 .txt`.err" + shift + + # Run test. + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect-CREATED + elif cmp -s $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected output (*.txt) differs from actual output (*.out)" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi + +} # This is different from $srcdir/../../bin/output_filter.sh STDOUT_FILTER() { @@ -630,6 +668,8 @@ fi # prepare for test COPY_TESTFILES_TO_TESTDIR +TOOLTEST_HELP h5repack-help.txt -h + # copy files (these files have no filters) TOOLTEST fill h5repack_fill.h5 TOOLTEST objs h5repack_objs.h5 diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 02337fd..521b9bd 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -1,36 +1,36 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * -* the files COPYING and Copyright.html. COPYING can be found at the root * -* of the source code distribution tree; Copyright.html can be found at the * -* root level of an installed copy of the electronic HDF5 document set and * -* is linked from the top-level documents page. It can also be found at * -* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -* access to either file, you may request a copy from help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" #include "h5tools.h" #include "h5tools_utils.h" /*------------------------------------------------------------------------- -* typedefs -*------------------------------------------------------------------------- -*/ + * typedefs + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- -* globals -*------------------------------------------------------------------------- -*/ + * globals + *------------------------------------------------------------------------- + */ /*------------------------------------------------------------------------- -* macros -*------------------------------------------------------------------------- -*/ + * macros + *------------------------------------------------------------------------- + */ /* size of buffer/# of bytes to xfer at a time when copying userblock */ #define USERBLOCK_XFER_SIZE 512 @@ -48,1701 +48,1630 @@ } \ } H5E_END_TRY; \ } - + /*------------------------------------------------------------------------- -* local functions -*------------------------------------------------------------------------- -*/ -static int Get_hyperslab (hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); -static void print_dataset_info(hid_t dcpl_id,char *objname,double per, int pr); -static int do_copy_objects(hid_t fidin,hid_t fidout,trav_table_t *travt,pack_opt_t *options); -static int copy_user_block(const char *infile, const char *outfile, hsize_t size); + * local functions + *------------------------------------------------------------------------- + */ +static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], + size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); +static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr); +static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, + pack_opt_t *options); +static int copy_user_block(const char *infile, const char *outfile, + hsize_t size); #if defined (H5REPACK_DEBUG_USER_BLOCK) -static void print_user_block(const char *filename, hid_t fid); +static void print_user_block(const char *filename, hid_t fid); #endif static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata); /* get the major number from the error stack. */ -static herr_t walk_error_callback(UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) -{ - if (err_desc) - *((int *)udata) = err_desc->maj_num; - - return 0; +static herr_t walk_error_callback(UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { + if (err_desc) + *((int *) udata) = err_desc->maj_num; + + return 0; } /*------------------------------------------------------------------------- -* Function: copy_objects -* -* Purpose: duplicate all HDF5 objects in the file -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: October, 23, 2003 -* -* Modification: -* Peter Cao, June 13, 2007 -* Add "-L, --latest" and other options to pack a file with the latest file format -* -* Peter Cao, September 25, 2007 -* Copy user block when repacking a file -* -* Pedro Vicente, August 20, 2008 -* Add a user block to file if requested -* -*------------------------------------------------------------------------- -*/ - -int copy_objects(const char* fnamein, - const char* fnameout, - pack_opt_t *options) -{ - hid_t fidin; - hid_t fidout = -1; - trav_table_t *travt = NULL; - hsize_t ub_size = 0; /* size of user block */ - hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ - hid_t fapl = H5P_DEFAULT; /* file access property list ID */ - - /*------------------------------------------------------------------------- - * open input file - *------------------------------------------------------------------------- - */ - if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) - { - error_msg("<%s>: %s\n", fnamein, H5FOPENERROR ); - goto out; - } - - /* get user block size and file space strategy/threshold */ - { - hid_t fcpl_in; /* file creation property list ID for input file */ - - if((fcpl_in = H5Fget_create_plist(fidin)) < 0) - { - error_msg("failed to retrieve file creation property list\n"); - goto out; - } - - if(H5Pget_userblock(fcpl_in, &ub_size) < 0) - { - error_msg("failed to retrieve userblock size\n"); - goto out; - } - - if(!options->fs_strategy) - { - if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) - { - error_msg("failed to retrieve file space strategy\n"); - goto out; - } - } - - if(!options->fs_threshold) - { - if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) - { - error_msg("failed to retrieve file space threshold\n"); - goto out; - } - } - - if(H5Pclose(fcpl_in) < 0) - { - error_msg("failed to close property list\n"); - goto out; - } - } - - /* Check if we need to create a non-default file creation property list */ - if(options->latest || ub_size > 0) - { - /* Create file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - - if(ub_size > 0) - { - if(H5Pset_userblock(fcpl, ub_size) < 0) - { - error_msg("failed to set non-default userblock size\n"); - goto out; - } - } - - if(options->latest) - { - unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; - - /* Adjust group creation parameters for root group */ - /* (So that it is created in "dense storage" form) */ - if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) - { - error_msg("fail to adjust group creation parameters for root group\n"); - goto out; - } - - for(i = 0; i < 5; i++) - { - if(options->msg_size[i] > 0) - { - switch(i) - { - case 0: - mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; - break; - - case 1: - mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; - break; - - case 2: - mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; - break; - - case 3: - mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; - break; - - case 4: - mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; - break; - default: - break; - } /* end switch */ - min_mesg_sizes[nindex] = (unsigned)options->msg_size[i]; - - nindex++; - } /* end if */ - } /* end for */ - - if(nindex > 0) - { - if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) - { - error_msg("fail to set the number of shared object header message indexes\n"); - goto out; - } - - /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ - for(i = 0; i < (nindex - 1); i++) - { - if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) { - error_msg("fail to configure the specified shared object header message index\n"); - goto out; - } /* end if */ - } /* end for */ - } /* if (nindex>0) */ - - /* Create file access property list */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - { - error_msg("Could not create file access property list\n"); - goto out; - } /* end if */ - - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - { - error_msg("Could not set property for using latest version of the format\n"); - goto out; - } /* end if */ - } /* end if */ - } /* end if */ + * Function: copy_objects + * + * Purpose: duplicate all HDF5 objects in the file + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: October, 23, 2003 + * + * Modification: + * Peter Cao, June 13, 2007 + * Add "-L, --latest" and other options to pack a file with the latest file format + * + * Peter Cao, September 25, 2007 + * Copy user block when repacking a file + * + * Pedro Vicente, August 20, 2008 + * Add a user block to file if requested + * + *------------------------------------------------------------------------- + */ + +int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { + hid_t fidin; + hid_t fidout = -1; + trav_table_t *travt = NULL; + hsize_t ub_size = 0; /* size of user block */ + hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ + hid_t fapl = H5P_DEFAULT; /* file access property list ID */ + + /*------------------------------------------------------------------------- + * open input file + *------------------------------------------------------------------------- + */ + if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, + (size_t) 0)) < 0) { + error_msg("<%s>: %s\n", fnamein, H5FOPENERROR); + goto out; + } + + /* get user block size and file space strategy/threshold */ + { + hid_t fcpl_in; /* file creation property list ID for input file */ + + if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) { + error_msg("failed to retrieve file creation property list\n"); + goto out; + } + + if (H5Pget_userblock(fcpl_in, &ub_size) < 0) { + error_msg("failed to retrieve userblock size\n"); + goto out; + } + + if (!options->fs_strategy) { + if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) { + error_msg("failed to retrieve file space strategy\n"); + goto out; + } + } + + if (!options->fs_threshold) { + if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) { + error_msg("failed to retrieve file space threshold\n"); + goto out; + } + } + + if (H5Pclose(fcpl_in) < 0) { + error_msg("failed to close property list\n"); + goto out; + } + } + + /* Check if we need to create a non-default file creation property list */ + if (options->latest || ub_size > 0) { + /* Create file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + goto out; + } + + if (ub_size > 0) { + if (H5Pset_userblock(fcpl, ub_size) < 0) { + error_msg("failed to set non-default userblock size\n"); + goto out; + } + } + + if (options->latest) { + unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; + + /* Adjust group creation parameters for root group */ + /* (So that it is created in "dense storage" form) */ + if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, + (unsigned) options->grp_indexed) < 0) { + error_msg( + "fail to adjust group creation parameters for root group\n"); + goto out; + } + + for (i = 0; i < 5; i++) { + if (options->msg_size[i] > 0) { + switch (i) { + case 0: + mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG; + break; + + case 1: + mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG; + break; + + case 2: + mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG; + break; + + case 3: + mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG; + break; + + case 4: + mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG; + break; + default: + break; + } /* end switch */ + min_mesg_sizes[nindex] = (unsigned) options->msg_size[i]; + + nindex++; + } /* end if */ + } /* end for */ + + if (nindex > 0) { + if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { + error_msg( + "fail to set the number of shared object header message indexes\n"); + goto out; + } + + /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ + for (i = 0; i < (nindex - 1); i++) { + if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], + min_mesg_sizes[i]) < 0) { + error_msg( + "fail to configure the specified shared object header message index\n"); + goto out; + } /* end if */ + } /* end for */ + } /* if (nindex>0) */ + + /* Create file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + error_msg("Could not create file access property list\n"); + goto out; + } /* end if */ + + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + error_msg( + "Could not set property for using latest version of the format\n"); + goto out; + } /* end if */ + } /* end if */ + } /* end if */ #if defined (H5REPACK_DEBUG_USER_BLOCK) - print_user_block(fnamein, fidin); + print_user_block(fnamein, fidin); #endif - /*------------------------------------------------------------------------- - * set the new user userblock options in the FCPL (before H5Fcreate ) - *------------------------------------------------------------------------- - */ - if ( options->ublock_size > 0 ) - { - /* either use the FCPL already created or create a new one */ - if(fcpl == H5P_DEFAULT) - { - /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - } - - /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) - { - error_msg("failed to set userblock size\n"); - goto out; - } - } - - /*------------------------------------------------------------------------- - * set alignment options - *------------------------------------------------------------------------- - */ - if ( options->alignment > 0 ) - { - /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) - { - /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - { - error_msg("Could not create file access property list\n"); - goto out; - } - } - - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) - { - error_msg("failed to set alignment\n"); - goto out; - } - } - - /*------------------------------------------------------------------------- - * set metadata block size option - *------------------------------------------------------------------------- - */ - if ( options->meta_block_size > 0 ) - { - /* either use the FAPL already created or create a new one */ - if (fapl == H5P_DEFAULT) - { - /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - { - error_msg("Could not create file access property list\n"); - goto out; - } - } - - if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) - { - error_msg("failed to set metadata block size\n"); - goto out; - } - } - - /*------------------------------------------------------------------------- - * set free-space strategy options - *------------------------------------------------------------------------- - */ - - /* either use the FCPL already created or create a new one */ - if(fcpl == H5P_DEFAULT) - { - /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - } - - /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) - { - error_msg("failed to set file space strategy & threshold \n"); - goto out; - } - - /*------------------------------------------------------------------------- - * create the output file - *------------------------------------------------------------------------- - */ - if(options->verbose) - printf("Making file <%s>...\n",fnameout); - - if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) - { - error_msg("<%s>: Could not create file\n", fnameout ); - goto out; - } - - - /*------------------------------------------------------------------------- - * write a new user block if requested - *------------------------------------------------------------------------- - */ - if ( options->ublock_size > 0 ) - { - if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 ) - { - error_msg("Could not copy user block. Exiting...\n"); - goto out; - - } - } - - /*------------------------------------------------------------------------- - * get list of objects - *------------------------------------------------------------------------- - */ - - /* init table */ - trav_table_init(&travt); - - /* get the list of objects in the file */ - if(h5trav_gettable(fidin, travt) < 0) - goto out; - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - if(do_copy_objects(fidin, fidout, travt, options) < 0) - { - error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); - goto out; - } /* end if */ - - /*------------------------------------------------------------------------- - * do the copy of referenced objects - * and create hard links - *------------------------------------------------------------------------- - */ - if ( do_copy_refobjs(fidin, fidout, travt, options) < 0 ) - { - printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); - goto out; - } - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if(fapl > 0) - H5Pclose(fapl); - - if(fcpl > 0) - H5Pclose(fcpl); - - H5Fclose(fidin); - H5Fclose(fidout); - - /* free table */ - trav_table_free(travt); - travt = NULL; - - /*------------------------------------------------------------------------- - * write only the input file user block if there is no user block file input - *------------------------------------------------------------------------- - */ - - if( ub_size > 0 && options->ublock_size == 0 ) - { - if ( copy_user_block(fnamein, fnameout, ub_size) < 0 ) - { - error_msg("Could not copy user block. Exiting...\n"); - goto out; - - } - } - - return 0; - - /*------------------------------------------------------------------------- - * out - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * set the new user userblock options in the FCPL (before H5Fcreate ) + *------------------------------------------------------------------------- + */ + if (options->ublock_size > 0) { + /* either use the FCPL already created or create a new one */ + if (fcpl == H5P_DEFAULT) { + /* create a file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + goto out; + } + } + + /* set user block size */ + if (H5Pset_userblock(fcpl, options->ublock_size) < 0) { + error_msg("failed to set userblock size\n"); + goto out; + } + } + + /*------------------------------------------------------------------------- + * set alignment options + *------------------------------------------------------------------------- + */ + if (options->alignment > 0) { + /* either use the FAPL already created or create a new one */ + if (fapl == H5P_DEFAULT) { + /* create a file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + error_msg("Could not create file access property list\n"); + goto out; + } + } + + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { + error_msg("failed to set alignment\n"); + goto out; + } + } + + /*------------------------------------------------------------------------- + * set metadata block size option + *------------------------------------------------------------------------- + */ + if (options->meta_block_size > 0) { + /* either use the FAPL already created or create a new one */ + if (fapl == H5P_DEFAULT) { + /* create a file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + error_msg("Could not create file access property list\n"); + goto out; + } + } + + if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) { + error_msg("failed to set metadata block size\n"); + goto out; + } + } + + /*------------------------------------------------------------------------- + * set free-space strategy options + *------------------------------------------------------------------------- + */ + + /* either use the FCPL already created or create a new one */ + if (fcpl == H5P_DEFAULT) { + /* create a file creation property list */ + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + error_msg("fail to create a file creation property list\n"); + goto out; + } + } + + /* set file space strategy and free space threshold */ + if (H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { + error_msg("failed to set file space strategy & threshold \n"); + goto out; + } + + /*------------------------------------------------------------------------- + * create the output file + *------------------------------------------------------------------------- + */ + if (options->verbose) + printf("Making file <%s>...\n", fnameout); + + if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { + error_msg("<%s>: Could not create file\n", fnameout); + goto out; + } + + /*------------------------------------------------------------------------- + * write a new user block if requested + *------------------------------------------------------------------------- + */ + if (options->ublock_size > 0) { + if (copy_user_block(options->ublock_filename, fnameout, + options->ublock_size) < 0) { + error_msg("Could not copy user block. Exiting...\n"); + goto out; + + } + } + + /*------------------------------------------------------------------------- + * get list of objects + *------------------------------------------------------------------------- + */ + + /* init table */ + trav_table_init(&travt); + + /* get the list of objects in the file */ + if (h5trav_gettable(fidin, travt) < 0) + goto out; + + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + if (do_copy_objects(fidin, fidout, travt, options) < 0) { + error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); + goto out; + } /* end if */ + + /*------------------------------------------------------------------------- + * do the copy of referenced objects + * and create hard links + *------------------------------------------------------------------------- + */ + if (do_copy_refobjs(fidin, fidout, travt, options) < 0) { + printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, + fnameout); + goto out; + } + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + if (fapl > 0) + H5Pclose(fapl); + + if (fcpl > 0) + H5Pclose(fcpl); + + H5Fclose(fidin); + H5Fclose(fidout); + + /* free table */ + trav_table_free(travt); + travt = NULL; + + /*------------------------------------------------------------------------- + * write only the input file user block if there is no user block file input + *------------------------------------------------------------------------- + */ + + if (ub_size > 0 && options->ublock_size == 0) { + if (copy_user_block(fnamein, fnameout, ub_size) < 0) { + error_msg("Could not copy user block. Exiting...\n"); + goto out; + + } + } + + return 0; + + /*------------------------------------------------------------------------- + * out + *------------------------------------------------------------------------- + */ out: - H5E_BEGIN_TRY - { - H5Pclose(fapl); - H5Pclose(fcpl); - H5Fclose(fidin); - H5Fclose(fidout); - } H5E_END_TRY; - if(travt) - trav_table_free(travt); - - return -1; + H5E_BEGIN_TRY + { + H5Pclose(fapl); + H5Pclose(fcpl); + H5Fclose(fidin); + H5Fclose(fidout); + }H5E_END_TRY; + if (travt) + trav_table_free(travt); + + return -1; } /*------------------------------------------------------------------------- -* Function: Get_hyperslab -* -* Purpose: Calulate a hyperslab from a dataset for higher performance. -* The size of hyperslab is limitted by H5TOOLS_BUFSIZE. -* Return the hyperslab dimentions and size in byte. -* -* Return: 0 - SUCCEED, -1 FAILED -* -* Parameters: -* dcpl_id : [IN] dataset creation property. -* rank_dset : [IN] dataset rank -* dims_dset[] : [IN] dataset dimentions -* size_datum : [IN] size of a data element in byte -* dims_hslab[] : [OUT] calculated hyperslab dimentions -* * hslab_nbytes_p : [OUT] total byte of the hyperslab -* -* Programmer: Jonathan Kim -* Date: Feburary, 2012 -* Update: -* The hyperslab calucation would be depend on if the dataset is chunked -* or not. -* -* There care 3 conditions to cover: -* 1. If chunked and a chunk fits in buffer, each chunk would be a unit of -* collection and the boundary would be dataset's dims. -* 2. If chunked but a chunk doesn't fit in buffer, each data element would -* be a unit of collection and the boundary would be the chunk itself. -* 3. If not chunked, each data element would be a unit of collection and -* the boundary would be dataset's dims. -* -* The calulation starts from the last dimention (h5dump dims output). -* -* Note: -* Added for JIRA HDFFV-7862. -*-----------------------------------------*/ - -int Get_hyperslab (hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], - size_t size_datum, - hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) -{ - int status = 0; - int k; - H5D_layout_t dset_layout; - int rank_chunk; - hsize_t dims_chunk[H5S_MAX_RANK]; - hsize_t size_chunk=1; - hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ - hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ - hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ - hsize_t hslab_nbytes; /* size of hyperslab in byte */ - - /* init to set as size of a data element */ - hslab_nbytes = size_datum; - - /* get layout of dataset */ - dset_layout = H5Pget_layout(dcpl_id); - - /* if dataset is chunked */ - if ( dset_layout == H5D_CHUNKED ) - { - /* get chunk dims */ - rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); - if (rank_chunk < 0) - { - status = -1; - goto out; - } - - for (k = rank_dset; k > 0; --k) - size_chunk *= dims_chunk[k-1]; - - /* figure out how many chunks can fit in the hyperslab buffer */ - nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; - - - /* 1. if a chunk fit in hyperslab buffer */ - if (nchunk_fit >= 1) - { - /* Calulate a hyperslab that contains as many chunks that can fit - * in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - * In the loop, used mapping from a datum to a chunk to figure out - * chunk based hyperslab. - */ - for (k = rank_dset; k > 0; --k) - { - /* map dataset dimentions with a chunk dims */ - chunk_dims_map[k-1]= dims_dset[k-1] / dims_chunk[k-1]; - - /* if reminder exist, increse by 1 to cover partial edge chunks */ - if (dims_dset[k-1] % dims_chunk[k-1] > 0) - chunk_dims_map[k-1]++; - - /* get mapped hyperslab dims */ - hs_dims_map[k-1] = MIN (nchunk_fit, chunk_dims_map[k-1]); - - /* prepare next round */ - nchunk_fit = nchunk_fit / chunk_dims_map[k-1]; - /* if a chunk is bigger than the rest of buffer */ - if (nchunk_fit == 0) - nchunk_fit=1; - - /* get hyperslab dimentions as unmapping to actual size */ - dims_hslab[k-1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k-1]; - } - } - /* 2. if a chunk is bigger than hyperslab buffer */ - else - { - /* Calulate a hyperslab that contains as many data elements that - * can fit in hyperslab buffer. Hyperslab will be increased - * starting from the last dimention of the chunk (see h5dump's dims - * output). - * The calculation boundary is a chunk dims. - */ - for (k = rank_dset; k > 0; --k) - { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if ( ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within a chunk boundary */ - dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) - { - status = -1; - goto out; - } - } - } - } - /* 3. if dataset is not chunked */ - else - { - /* Calulate a hyperslab that contains as many data elements that can - * fit in hyperslab buffer. Hyperslab will be increased starting from - * the last dimention of the dataset (see h5dump's dims output). - * The calculation boundary is dataset dims. - */ - for (k = rank_dset; k > 0; --k) - { - ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; - - /* if a datum is bigger than rest of buffer */ - if ( ndatum_fit == 0) - ndatum_fit = 1; - /* get hyperslab dimentions within dataset boundary */ - dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); - - /* calculate total size for the hyperslab */ - hslab_nbytes *= dims_hslab[k - 1]; - - if (hslab_nbytes <= 0) - { - status = -1; - goto out; - } - } - } - - /* pass out the hyperslab size*/ - *hslab_nbytes_p = hslab_nbytes; + * Function: Get_hyperslab + * + * Purpose: Calulate a hyperslab from a dataset for higher performance. + * The size of hyperslab is limitted by H5TOOLS_BUFSIZE. + * Return the hyperslab dimentions and size in byte. + * + * Return: 0 - SUCCEED, -1 FAILED + * + * Parameters: + * dcpl_id : [IN] dataset creation property. + * rank_dset : [IN] dataset rank + * dims_dset[] : [IN] dataset dimentions + * size_datum : [IN] size of a data element in byte + * dims_hslab[] : [OUT] calculated hyperslab dimentions + * * hslab_nbytes_p : [OUT] total byte of the hyperslab + * + * Programmer: Jonathan Kim + * Date: Feburary, 2012 + * Update: + * The hyperslab calucation would be depend on if the dataset is chunked + * or not. + * + * There care 3 conditions to cover: + * 1. If chunked and a chunk fits in buffer, each chunk would be a unit of + * collection and the boundary would be dataset's dims. + * 2. If chunked but a chunk doesn't fit in buffer, each data element would + * be a unit of collection and the boundary would be the chunk itself. + * 3. If not chunked, each data element would be a unit of collection and + * the boundary would be dataset's dims. + * + * The calulation starts from the last dimention (h5dump dims output). + * + * Note: + * Added for JIRA HDFFV-7862. + *-----------------------------------------*/ + +int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], + size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) { + int status = 0; + int k; + H5D_layout_t dset_layout; + int rank_chunk; + hsize_t dims_chunk[H5S_MAX_RANK]; + hsize_t size_chunk = 1; + hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ + hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ + hsize_t hslab_nbytes; /* size of hyperslab in byte */ + + /* init to set as size of a data element */ + hslab_nbytes = size_datum; + + /* get layout of dataset */ + dset_layout = H5Pget_layout(dcpl_id); + + /* if dataset is chunked */ + if (dset_layout == H5D_CHUNKED) { + /* get chunk dims */ + rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); + if (rank_chunk < 0) { + status = -1; + goto out; + } + + for (k = rank_dset; k > 0; --k) + size_chunk *= dims_chunk[k - 1]; + + /* figure out how many chunks can fit in the hyperslab buffer */ + nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; + + /* 1. if a chunk fit in hyperslab buffer */ + if (nchunk_fit >= 1) { + /* Calulate a hyperslab that contains as many chunks that can fit + * in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + * In the loop, used mapping from a datum to a chunk to figure out + * chunk based hyperslab. + */ + for (k = rank_dset; k > 0; --k) { + /* map dataset dimentions with a chunk dims */ + chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1]; + + /* if reminder exist, increse by 1 to cover partial edge chunks */ + if (dims_dset[k - 1] % dims_chunk[k - 1] > 0) + chunk_dims_map[k - 1]++; + + /* get mapped hyperslab dims */ + hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]); + + /* prepare next round */ + nchunk_fit = nchunk_fit / chunk_dims_map[k - 1]; + /* if a chunk is bigger than the rest of buffer */ + if (nchunk_fit == 0) + nchunk_fit = 1; + + /* get hyperslab dimentions as unmapping to actual size */ + dims_hslab[k - 1] = + MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + } + } + /* 2. if a chunk is bigger than hyperslab buffer */ + else { + /* Calulate a hyperslab that contains as many data elements that + * can fit in hyperslab buffer. Hyperslab will be increased + * starting from the last dimention of the chunk (see h5dump's dims + * output). + * The calculation boundary is a chunk dims. + */ + for (k = rank_dset; k > 0; --k) { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if (ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within a chunk boundary */ + dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) { + status = -1; + goto out; + } + } + } + } + /* 3. if dataset is not chunked */ + else { + /* Calulate a hyperslab that contains as many data elements that can + * fit in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + */ + for (k = rank_dset; k > 0; --k) { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if (ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within dataset boundary */ + dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) { + status = -1; + goto out; + } + } + } + + /* pass out the hyperslab size*/ + *hslab_nbytes_p = hslab_nbytes; out: - return status; + return status; } /*------------------------------------------------------------------------- -* Function: do_copy_objects -* -* Purpose: duplicate all HDF5 objects in the file -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu -* -* Date: October, 23, 2003 -* -* Modifications: -* -* July 2004: Introduced the extra EC or NN option for SZIP -* -* December 2004: Added a check for H5Dcreate; if the dataset cannot be created -* with the requested filter, use the input one -* -* October 2006: Read/write using the file type by default. -* -* October 2006: Read by hyperslabs for big datasets. -* -* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done -* i.e., if the memory needed to read a dataset is greater than this limit, -* then hyperslab I/O is done instead of one operation I/O -* For each dataset, the memory needed is calculated according to -* -* memory needed = number of elements * size of each element -* -* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations -* are done -* -* H5Dread( input_dataset1 ) -* H5Dread( input_dataset2 ) -* -* with all elements in the datasets selected. If the memory needed is greater than -* H5TOOLS_MALLOCSIZE, then the following operations are done instead: -* -* a strip mine is defined for each dimension k (a strip mine is defined as a -* hyperslab whose size is memory manageable) according to the formula -* -* (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) -* -* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures -* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip -* mine size k is simply defined as its dimension k, but for larger datasets the -* hyperslab size is still memory manageable. -* a cycle is done until the number of elements in the dataset is reached. In each -* iteration, two parameters are defined for the function H5Sselect_hyperslab, -* the start and size of each hyperslab, according to -* -* (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) -* -* where hyperslab_offset [k] is initially set to zero, and later incremented in -* hyperslab_size[k] offsets. The reason for the operation -* -* dimension[k] - hyperslab_offset[k] -* -* in (2) is that, when using the strip mine size, it assures that the "remaining" part -* of the dataset that does not fill an entire strip mine is processed. -* -* November 2006: Use H5Ocopy in the copy of objects. The logic for using -* H5Ocopy or not is if a change of filters or layout is requested by the user -* then use read/write else use H5Ocopy. -* -* May, 1, 2008: Add a printing of the compression ratio of old size / new size -* -* Feburary 2012: improve Read/Write by hyperslabs for big datasets. -* Programmer: Jonathan Kim -* -* A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done -* i.e., if the memory needed to read a dataset is greater than this limit, -* then hyperslab I/O is done instead of one operation I/O -* For each dataset, the memory needed is calculated according to -* -* memory needed = number of elements * size of each element -* -* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations -* are done -* -* H5Dread( input_dataset ) -* H5Dwrite( output_dataset ) -* -* with all elements in the datasets selected. If the memory needed is greater than -* H5TOOLS_MALLOCSIZE, then the following operations are done instead: -* -* 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). -* 2. Calculate the hyperslab selections as the selection is moving forward. -* Selection would be same as the hyperslab except for the remaining edge portion -* of the dataset. The code take care of the remaining portion if exist. -* -*------------------------------------------------------------------------- -*/ - -int do_copy_objects(hid_t fidin, - hid_t fidout, - trav_table_t *travt, - pack_opt_t *options) /* repack options */ + * Function: do_copy_objects + * + * Purpose: duplicate all HDF5 objects in the file + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: October, 23, 2003 + * + * Modifications: + * + * July 2004: Introduced the extra EC or NN option for SZIP + * + * December 2004: Added a check for H5Dcreate; if the dataset cannot be created + * with the requested filter, use the input one + * + * October 2006: Read/write using the file type by default. + * + * October 2006: Read by hyperslabs for big datasets. + * + * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done + * i.e., if the memory needed to read a dataset is greater than this limit, + * then hyperslab I/O is done instead of one operation I/O + * For each dataset, the memory needed is calculated according to + * + * memory needed = number of elements * size of each element + * + * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations + * are done + * + * H5Dread( input_dataset1 ) + * H5Dread( input_dataset2 ) + * + * with all elements in the datasets selected. If the memory needed is greater than + * H5TOOLS_MALLOCSIZE, then the following operations are done instead: + * + * a strip mine is defined for each dimension k (a strip mine is defined as a + * hyperslab whose size is memory manageable) according to the formula + * + * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) + * + * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures + * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip + * mine size k is simply defined as its dimension k, but for larger datasets the + * hyperslab size is still memory manageable. + * a cycle is done until the number of elements in the dataset is reached. In each + * iteration, two parameters are defined for the function H5Sselect_hyperslab, + * the start and size of each hyperslab, according to + * + * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) + * + * where hyperslab_offset [k] is initially set to zero, and later incremented in + * hyperslab_size[k] offsets. The reason for the operation + * + * dimension[k] - hyperslab_offset[k] + * + * in (2) is that, when using the strip mine size, it assures that the "remaining" part + * of the dataset that does not fill an entire strip mine is processed. + * + * November 2006: Use H5Ocopy in the copy of objects. The logic for using + * H5Ocopy or not is if a change of filters or layout is requested by the user + * then use read/write else use H5Ocopy. + * + * May, 1, 2008: Add a printing of the compression ratio of old size / new size + * + * Feburary 2012: improve Read/Write by hyperslabs for big datasets. + * Programmer: Jonathan Kim + * + * A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done + * i.e., if the memory needed to read a dataset is greater than this limit, + * then hyperslab I/O is done instead of one operation I/O + * For each dataset, the memory needed is calculated according to + * + * memory needed = number of elements * size of each element + * + * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations + * are done + * + * H5Dread( input_dataset ) + * H5Dwrite( output_dataset ) + * + * with all elements in the datasets selected. If the memory needed is greater than + * H5TOOLS_MALLOCSIZE, then the following operations are done instead: + * + * 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). + * 2. Calculate the hyperslab selections as the selection is moving forward. + * Selection would be same as the hyperslab except for the remaining edge portion + * of the dataset. The code take care of the remaining portion if exist. + * + *------------------------------------------------------------------------- + */ + +int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, + pack_opt_t *options) /* repack options */ { - hid_t grp_in = -1; /* group ID */ - hid_t grp_out = -1; /* group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t gcpl_in = -1; /* group creation property list */ - hid_t gcpl_out = -1; /* group creation property list */ - hid_t type_in = -1; /* named type ID */ - hid_t type_out = -1; /* named type ID */ - hid_t dcpl_in = -1; /* dataset creation property list ID */ - hid_t dcpl_out = -1; /* dataset creation property list ID */ - hid_t f_space_id = -1; /* file space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ - named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ - size_t msize; /* size of type */ - hsize_t nelmts; /* number of elements in dataset */ - H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */ - int rank; /* rank of dataset */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - hsize_t dsize_in; /* input dataset size before filter */ - hsize_t dsize_out; /* output dataset size after filter */ - int apply_s; /* flag for apply filter to small dataset sizes */ - int apply_f; /* flag for apply filter to return error on H5Dcreate */ - void *buf=NULL; /* buffer for raw data */ - void *hslab_buf=NULL; /* hyperslab buffer for raw data */ - int has_filter; /* current object has a filter */ - int req_filter; /* there was a request for a filter */ - int req_obj_layout=0; /* request layout to current object */ - unsigned crt_order_flags; /* group creation order flag */ - unsigned i; - unsigned u; - int is_ref=0; - htri_t is_named; - hbool_t limit_maxdims; - hsize_t size_dset; - - - /*------------------------------------------------------------------------- - * copy the suppplied object list - *------------------------------------------------------------------------- - */ - - if (options->verbose) - { - printf("-----------------------------------------\n"); - printf(" Type Filter (Compression) Name\n"); - printf("-----------------------------------------\n"); - } - - for ( i = 0; i < travt->nobjs; i++) - { - /* init variables per obj */ - buf = NULL; - limit_maxdims = FALSE; - - switch ( travt->objs[i].type ) - { - - case H5TRAV_TYPE_UNKNOWN: - HDassert(0); - break; - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_GROUP - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_GROUP: - - if (options->verbose) - { - printf(FORMAT_OBJ,"group",travt->objs[i].name ); - } - - /* open input group */ - if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - - /* get input group creation property list */ - if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - goto error; - - /* query and set the group creation properties */ - if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - goto error; - - /* set up group creation property list */ - if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) - goto error; - - if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) - goto error; - - - /*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group - * and copy its attributes using that ID - *------------------------------------------------------------------------- - */ - if(HDstrcmp(travt->objs[i].name, "/") == 0) - { - if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) - goto error; - } - - else - { - - if (options->grp_compact>0 || options->grp_indexed>0) - { - if(H5Pset_link_phase_change(gcpl_out, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) - goto error; - } - - if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) - goto error; - - } - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if(copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) - goto error; - - - if(H5Pclose(gcpl_out) < 0) - goto error; - if(H5Pclose(gcpl_in) < 0) - goto error; - if(H5Gclose(grp_out) < 0) - goto error; - if(H5Gclose(grp_in) < 0) - goto error; - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_DATASET: - - has_filter = 0; - req_filter = 0; - - /* check if global filters were requested */ - if ( options->n_filter_g ) - req_filter = 1; - - /* check if filters were requested for individual objects */ - for (u = 0; u < options->op_tbl->nelems; u++) { - - if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) { - if (options->op_tbl->objs[u].filter->filtn > 0) { - req_filter = 1; - } - } - } - - /* check if layout change requested individual object */ - if (options->layout_g != H5D_LAYOUT_ERROR) - { - pack_info_t *pckinfo; - /* any dataset is specified */ - if (options->op_tbl->nelems > 0) - { - /* check if object exist */ - pckinfo = options_get_object (travt->objs[i].name, options->op_tbl); - if (pckinfo) - { - req_obj_layout = 1; - } - } - } - - /* early detection of references */ - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if((ftype_id = H5Dget_type(dset_in)) < 0) - goto error; - if(H5T_REFERENCE == H5Tget_class(ftype_id)) - is_ref = 1; - - /* Check if the datatype is committed */ - if((is_named = H5Tcommitted(ftype_id)) < 0) - goto error; - if(is_named) - if((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0) - goto error; - - if(H5Tclose(ftype_id) < 0) - goto error; - if(H5Dclose(dset_in) < 0) - goto error; - - - /*------------------------------------------------------------------------- - * check if we should use H5Ocopy or not - * if there is a request for filters/layout, we read/write the object - * otherwise we do a copy using H5Ocopy - *------------------------------------------------------------------------- - */ - if ( options->op_tbl->nelems || - options->all_filter == 1 || - options->all_layout == 1 || - is_ref || - is_named) - { - - int j; - - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if((f_space_id = H5Dget_space(dset_in)) < 0) - goto error; - if((ftype_id = H5Dget_type(dset_in)) < 0) - goto error; - if((dcpl_in = H5Dget_create_plist(dset_in)) < 0) - goto error; - if((dcpl_out = H5Pcopy(dcpl_in)) < 0) - goto error; - if((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) - goto error; - HDmemset(dims, 0, sizeof dims); - if(H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) - goto error; - - if(H5Dget_space_status(dset_in, &space_status) < 0) - goto error; - - nelmts = 1; - for(j = 0; j < rank; j++) - nelmts *= dims[j]; - - /* wtype_id will have already been set if using a named dtype */ - if(!is_named) { - if(options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end if */ - - if((msize = H5Tget_size(wtype_id)) == 0) - goto error; - - /* size of current dset */ - size_dset = nelmts * msize; - - /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration - * 1) the external filters GZIP and SZIP might not be available - * 2) the internal filters might be turned off - *------------------------------------------------------------------------- - */ - if (h5tools_canreadf((travt->objs[i].name),dcpl_in)==1) - { - apply_s=1; - apply_f=1; - - /*------------------------------------------------------------------------- - * references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - * in a second traversal of the output file - *------------------------------------------------------------------------- - */ - if (H5T_REFERENCE!=H5Tget_class(wtype_id)) - { - /* 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) - { - if (apply_filters(travt->objs[i].name, - rank, - dims, - msize, - dcpl_out, - options, - &has_filter) < 0) - goto error; - } - - /* only if layout change requested for entire file or - * individual obj */ - if (options->all_layout > 0 || req_obj_layout == 1) - /*------------------------------------------------- - * Unset the unlimited max dims if convert to other - * than chunk layouts, because unlimited max dims - * only can be applied to chunk layout. - * Also perform only for targeted dataset - * Also check for size limit to convert to compact - *-------------------------------------------------*/ - if (options->layout_g != H5D_CHUNKED) - { - /* any dataset is specified */ - if (options->op_tbl->nelems > 0) - { - /* if current obj match specified obj */ - if (options_get_object (travt->objs[i].name, options->op_tbl)) - limit_maxdims = TRUE; - } - else /* no dataset is specified */ - { - limit_maxdims = TRUE; - } - - /* if convert to COMPACT */ - if (options->layout_g == H5D_COMPACT) - { - /* should be smaller than 64K */ - if ( size_dset > MAX_COMPACT_DSIZE ) - limit_maxdims = FALSE; - } - - /* unset unlimited max dims */ - if (limit_maxdims) - H5Sset_extent_simple( f_space_id, rank, dims, NULL ); - } - - /*------------------------------------------------------------------------- - * create the output dataset; - * disable error checking in case the dataset cannot be created with the - * modified dcpl; in that case use the original instead - *------------------------------------------------------------------------- - */ - H5E_BEGIN_TRY { - dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); - } H5E_END_TRY; - - if(dset_out == FAIL) - { - if(options->verbose) - printf(" warning: could not create dataset <%s>. Applying original settings\n", - travt->objs[i].name); - - if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) - goto error; - apply_f = 0; - } - - /*------------------------------------------------------------------------- - * read/write - *------------------------------------------------------------------------- - */ - if(nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) - { - size_t need = (size_t)(nelmts * msize); /* bytes needed */ - - /* have to read the whole dataset if there is only one element in the dataset */ - if(need < H5TOOLS_MALLOCSIZE) - buf = HDmalloc(need); - - if(buf != NULL) { - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - - /* Check if we have VL data in the dataset's - * datatype that must be reclaimed */ - if(TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) - if(H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0) - goto error; - } - else /* possibly not enough memory, read/write by hyperslabs */ - { - size_t p_type_nbytes = msize; /*size of memory type */ - hsize_t p_nelmts = nelmts; /*total elements */ - hsize_t elmtno; /*counter */ - int carry; /*counter carry value */ - unsigned int vl_data = 0; /*contains VL datatypes */ - - /* hyperslab info */ - hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */ - hsize_t hslab_nbytes; /*bytes per hyperslab */ - hsize_t hslab_nelmts; /*elements per hyperslab*/ - hid_t hslab_space; /*hyperslab data space */ - - /* hyperslab selection info */ - hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */ - hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */ - hsize_t hs_select_nelmts; /* selected elements */ - hsize_t zero[8]; /*vector of zeros */ - int k; - H5D_layout_t dset_layout; - hid_t dcpl_tmp = -1; /* dataset creation property list ID */ - - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) - vl_data = TRUE; - - - /* check first if writing dataset is chunked, - * if so use its chunk layout for better performance. */ - dset_layout = H5Pget_layout(dcpl_out); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_out; /* writing dataset */ - else /* if reading dataset is chunked */ - { - dset_layout = H5Pget_layout(dcpl_in); - if (dset_layout == H5D_CHUNKED) - dcpl_tmp = dcpl_in; /* reading dataset */ - } - - /* get hyperslab dims and size in byte */ - if(Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) - goto error; - - hslab_buf = HDmalloc((size_t)hslab_nbytes); - - hslab_nelmts = hslab_nbytes / p_type_nbytes; - hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); - - /* the hyperslab selection loop */ - HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset); - HDmemset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) - { - if (rank > 0) - { - /* calculate the hyperslab selections. The selection would be same as the hyperslab except for remaining edge portion of the dataset which is smaller then the hyperslab. - */ - for (k = 0, hs_select_nelmts = 1; k < rank; k++) - { - /* MIN() is used to get the remaining edge portion if exist. - * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ - hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); - hs_select_nelmts *= hs_sel_count[k]; - } - - if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) - goto error; - if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) - goto error; - } - else - { - H5Sselect_all(f_space_id); - H5Sselect_all(hslab_space); - hs_select_nelmts = 1; - } /* rank */ - - /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); - CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); - - /* reclaim any VL memory, if necessary */ - if(vl_data) - H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf); - - /* calculate the next hyperslab offset */ - for (k = rank, carry = 1; k > 0 && carry; --k) - { - hs_sel_offset[k - 1] += hs_sel_count[k - 1]; - /* if reached the end of a dim */ - if (hs_sel_offset[k - 1] == dims[k - 1]) - hs_sel_offset[k - 1] = 0; - else - carry = 0; - } /* k */ - } /* elmtno */ - - H5Sclose(hslab_space); - /* free */ - if (hslab_buf!=NULL) - { - HDfree(hslab_buf); - hslab_buf=NULL; - } - } /* hyperslab read */ - } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ - - /*------------------------------------------------------------------------- - * amount of compression used - *------------------------------------------------------------------------- - */ - if (options->verbose) - { - double ratio=0; - - /* only print the compression ration if there was a filter request */ - if (apply_s && apply_f && req_filter) - { - /* get the storage size of the output dataset */ - dsize_out=H5Dget_storage_size(dset_out); - - /* compression ratio = uncompressed size / compressed size */ - if (dsize_out!=0) - ratio = (double) dsize_in / (double) dsize_out; - - print_dataset_info(dcpl_out,travt->objs[i].name,ratio,1); - } - else - print_dataset_info(dcpl_in,travt->objs[i].name,ratio,0); - - /* print a message that the filter was not applied - (in case there was a filter) - */ - if ( has_filter && apply_s == 0 ) - printf(" \n", - travt->objs[i].name, - (int)options->min_comp); - - if ( has_filter && apply_f == 0 ) - printf(" \n", - travt->objs[i].name); - - } /* verbose */ - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - goto error; - - /*close */ - if (H5Dclose(dset_out) < 0) - goto error; - - }/*!H5T_REFERENCE*/ - }/*h5tools_canreadf*/ - - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - if (H5Tclose(ftype_id) < 0) - goto error; - if (H5Tclose(wtype_id) < 0) - goto error; - if (H5Pclose(dcpl_in) < 0) - goto error; - if (H5Pclose(dcpl_out) < 0) - goto error; - if (H5Sclose(f_space_id) < 0) - goto error; - if (H5Dclose(dset_in) < 0) - goto error; - - } - /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead - *------------------------------------------------------------------------- - */ - else - { - hid_t pid; - - /* create property to pass copy options */ - if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - goto error; - - /* set options for object copy */ - if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - goto error; - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - - if(H5Ocopy(fidin, /* Source file or group identifier */ - travt->objs[i].name, /* Name of the source object to be copied */ - fidout, /* Destination file or group identifier */ - travt->objs[i].name, /* Name of the destination object */ - pid, /* Properties which apply to the copy */ - H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ - goto error; - - /* close property */ - if(H5Pclose(pid) < 0) - goto error; - - - /*------------------------------------------------------------------------- - * copy attrs manually - *------------------------------------------------------------------------- - */ - if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - goto error; - if(H5Dclose(dset_in) < 0) - goto error; - if(H5Dclose(dset_out) < 0) - goto error; - - - if (options->verbose) - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - - - } /* end do we have request for filter/chunking */ - - - break; - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_NAMED_DATATYPE - *------------------------------------------------------------------------- - */ - case H5TRAV_TYPE_NAMED_DATATYPE: - - if(options->verbose) - printf(FORMAT_OBJ, "type", travt->objs[i].name); - - if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - goto error; - - /* Copy the datatype anonymously */ - if((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, - travt, options)) < 0) - goto error; - - /* Link in to group structure */ - if(H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, - H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if(copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) - goto error; - - if(H5Tclose(type_in) < 0) - goto error; - if(H5Tclose(type_out) < 0) - goto error; - - - - break; - - - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_LINK - * H5TRAV_TYPE_UDLINK - * - * Only handles external links; H5Lcopy will fail for other UD link types - * since we don't have creation or copy callbacks for them. - *------------------------------------------------------------------------- - */ - - case H5TRAV_TYPE_LINK: - case H5TRAV_TYPE_UDLINK: - { - - if(options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); - - if(H5Lcopy(fidin, travt->objs[i].name,fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; - - if (options->verbose) - printf(FORMAT_OBJ,"link",travt->objs[i].name ); - - } - break; - - default: - goto error; - } /* switch */ - - /* free */ - if (buf!=NULL) - { - HDfree(buf); - buf=NULL; - } - - } /* i */ - - /* Finalize (link) the stack of named datatypes (if any) */ - named_datatype_free(&named_dt_head, 0); - - return 0; + hid_t grp_in = -1; /* group ID */ + hid_t grp_out = -1; /* group ID */ + hid_t dset_in = -1; /* read dataset ID */ + hid_t dset_out = -1; /* write dataset ID */ + hid_t gcpl_in = -1; /* group creation property list */ + hid_t gcpl_out = -1; /* group creation property list */ + hid_t type_in = -1; /* named type ID */ + hid_t type_out = -1; /* named type ID */ + hid_t dcpl_in = -1; /* dataset creation property list ID */ + hid_t dcpl_out = -1; /* dataset creation property list ID */ + hid_t f_space_id = -1; /* file space ID */ + hid_t ftype_id = -1; /* file type ID */ + hid_t wtype_id = -1; /* read/write type ID */ + named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ + size_t msize; /* size of type */ + hsize_t nelmts; /* number of elements in dataset */ + H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */ + int rank; /* rank of dataset */ + hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ + hsize_t dsize_in; /* input dataset size before filter */ + hsize_t dsize_out; /* output dataset size after filter */ + int apply_s; /* flag for apply filter to small dataset sizes */ + int apply_f; /* flag for apply filter to return error on H5Dcreate */ + void *buf = NULL; /* buffer for raw data */ + void *hslab_buf = NULL; /* hyperslab buffer for raw data */ + int has_filter; /* current object has a filter */ + int req_filter; /* there was a request for a filter */ + int req_obj_layout = 0; /* request layout to current object */ + unsigned crt_order_flags; /* group creation order flag */ + unsigned i; + unsigned u; + int is_ref = 0; + htri_t is_named; + hbool_t limit_maxdims; + hsize_t size_dset; + + /*------------------------------------------------------------------------- + * copy the suppplied object list + *------------------------------------------------------------------------- + */ + + if (options->verbose) { + printf("-----------------------------------------\n"); + printf(" Type Filter (Compression) Name\n"); + printf("-----------------------------------------\n"); + } + + for (i = 0; i < travt->nobjs; i++) { + /* init variables per obj */ + buf = NULL; + limit_maxdims = FALSE; + + switch (travt->objs[i].type) { + + case H5TRAV_TYPE_UNKNOWN: + HDassert(0); + break; + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_GROUP + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_GROUP: + + if (options->verbose) { + printf(FORMAT_OBJ, "group", travt->objs[i].name); + } + + /* open input group */ + if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) + < 0) + goto error; + + /* get input group creation property list */ + if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) + goto error; + + /* query and set the group creation properties */ + if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) + goto error; + + /* set up group creation property list */ + if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + + if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) + goto error; + + /*------------------------------------------------------------------------- + * the root is a special case, we get an ID for the root group + * and copy its attributes using that ID + *------------------------------------------------------------------------- + */ + if (HDstrcmp(travt->objs[i].name, "/") == 0) { + if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) + goto error; + } + else { + + if (options->grp_compact > 0 || options->grp_indexed > 0) { + if (H5Pset_link_phase_change(gcpl_out, + (unsigned) options->grp_compact, + (unsigned) options->grp_indexed) < 0) + goto error; + } + + if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, + H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) + goto error; + + } + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) + goto error; + + if (H5Pclose(gcpl_out) < 0) + goto error; + if (H5Pclose(gcpl_in) < 0) + goto error; + if (H5Gclose(grp_out) < 0) + goto error; + if (H5Gclose(grp_in) < 0) + goto error; + + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_DATASET + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_DATASET: + + has_filter = 0; + req_filter = 0; + + /* check if global filters were requested */ + if (options->n_filter_g) + req_filter = 1; + + /* check if filters were requested for individual objects */ + for (u = 0; u < options->op_tbl->nelems; u++) { + + if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) { + if (options->op_tbl->objs[u].filter->filtn > 0) { + req_filter = 1; + } + } + } + + /* check if layout change requested individual object */ + if (options->layout_g != H5D_LAYOUT_ERROR) { + pack_info_t *pckinfo; + /* any dataset is specified */ + if (options->op_tbl->nelems > 0) { + /* check if object exist */ + pckinfo = options_get_object(travt->objs[i].name, + options->op_tbl); + if (pckinfo) { + req_obj_layout = 1; + } + } + } + + /* early detection of references */ + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) + < 0) + goto error; + if ((ftype_id = H5Dget_type(dset_in)) < 0) + goto error; + if (H5T_REFERENCE == H5Tget_class(ftype_id)) + is_ref = 1; + + /* Check if the datatype is committed */ + if ((is_named = H5Tcommitted(ftype_id)) < 0) + goto error; + if (is_named) + if ((wtype_id = copy_named_datatype(ftype_id, fidout, + &named_dt_head, travt, options)) < 0) + goto error; + + if (H5Tclose(ftype_id) < 0) + goto error; + if (H5Dclose(dset_in) < 0) + goto error; + + /*------------------------------------------------------------------------- + * check if we should use H5Ocopy or not + * if there is a request for filters/layout, we read/write the object + * otherwise we do a copy using H5Ocopy + *------------------------------------------------------------------------- + */ + if (options->op_tbl->nelems || options->all_filter == 1 + || options->all_layout == 1 || is_ref || is_named) { + + int j; + + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + if ((f_space_id = H5Dget_space(dset_in)) < 0) + goto error; + if ((ftype_id = H5Dget_type(dset_in)) < 0) + goto error; + if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) + goto error; + if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) + goto error; + if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) + goto error; + HDmemset(dims, 0, sizeof dims); + if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) + goto error; + + if (H5Dget_space_status(dset_in, &space_status) < 0) + goto error; + + nelmts = 1; + for (j = 0; j < rank; j++) + nelmts *= dims[j]; + + /* wtype_id will have already been set if using a named dtype */ + if (!is_named) { + if (options->use_native == 1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end if */ + + if ((msize = H5Tget_size(wtype_id)) == 0) + goto error; + + /* size of current dset */ + size_dset = nelmts * msize; + + /*------------------------------------------------------------------------- + * check if the dataset creation property list has filters that + * are not registered in the current configuration + * 1) the external filters GZIP and SZIP might not be available + * 2) the internal filters might be turned off + *------------------------------------------------------------------------- + */ + if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) { + apply_s = 1; + apply_f = 1; + + /*------------------------------------------------------------------------- + * references are a special case + * we cannot just copy the buffers, but instead we recreate the reference + * in a second traversal of the output file + *------------------------------------------------------------------------- + */ + if (H5T_REFERENCE != H5Tget_class(wtype_id)) { + /* 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) { + if (apply_filters(travt->objs[i].name, rank, dims, + msize, dcpl_out, options, &has_filter) < 0) + goto error; + } + + /* only if layout change requested for entire file or + * individual obj */ + if (options->all_layout > 0 || req_obj_layout == 1) + /*------------------------------------------------- + * Unset the unlimited max dims if convert to other + * than chunk layouts, because unlimited max dims + * only can be applied to chunk layout. + * Also perform only for targeted dataset + * Also check for size limit to convert to compact + *-------------------------------------------------*/ + if (options->layout_g != H5D_CHUNKED) { + /* any dataset is specified */ + if (options->op_tbl->nelems > 0) { + /* if current obj match specified obj */ + if (options_get_object(travt->objs[i].name, + options->op_tbl)) + limit_maxdims = TRUE; + } + else { /* no dataset is specified */ + limit_maxdims = TRUE; + } + + /* if convert to COMPACT */ + if (options->layout_g == H5D_COMPACT) { + /* should be smaller than 64K */ + if (size_dset > MAX_COMPACT_DSIZE) + limit_maxdims = FALSE; + } + + /* unset unlimited max dims */ + if (limit_maxdims) + H5Sset_extent_simple(f_space_id, rank, dims, + NULL); + } + + /*------------------------------------------------------------------------- + * create the output dataset; + * disable error checking in case the dataset cannot be created with the + * modified dcpl; in that case use the original instead + *------------------------------------------------------------------------- + */ + H5E_BEGIN_TRY + { + dset_out = H5Dcreate2(fidout, + travt->objs[i].name, wtype_id, + f_space_id, H5P_DEFAULT, dcpl_out, + H5P_DEFAULT); + }H5E_END_TRY; + + if (dset_out == FAIL) { + if (options->verbose) + printf( + " warning: could not create dataset <%s>. Applying original settings\n", + travt->objs[i].name); + + if ((dset_out = H5Dcreate2(fidout, + travt->objs[i].name, wtype_id, f_space_id, + H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) + goto error; + apply_f = 0; + } + + /*------------------------------------------------------------------------- + * read/write + *------------------------------------------------------------------------- + */ + if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) { + size_t need = (size_t)(nelmts * msize); /* bytes needed */ + + /* have to read the whole dataset if there is only one element in the dataset */ + if (need < H5TOOLS_MALLOCSIZE) + buf = HDmalloc(need); + + if (buf != NULL) { + /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ + CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, + H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, + H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + + /* Check if we have VL data in the dataset's + * datatype that must be reclaimed */ + if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) + if (H5Dvlen_reclaim(wtype_id, f_space_id, + H5P_DEFAULT, buf) < 0) + goto error; + } + else { /* possibly not enough memory, read/write by hyperslabs */ + size_t p_type_nbytes = msize; /*size of memory type */ + hsize_t p_nelmts = nelmts; /*total elements */ + hsize_t elmtno; /*counter */ + int carry; /*counter carry value */ + unsigned int vl_data = 0; /*contains VL datatypes */ + + /* hyperslab info */ + hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */ + hsize_t hslab_nbytes; /*bytes per hyperslab */ + hsize_t hslab_nelmts; /*elements per hyperslab*/ + hid_t hslab_space; /*hyperslab data space */ + + /* hyperslab selection info */ + hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */ + hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */ + hsize_t hs_select_nelmts; /* selected elements */ + hsize_t zero[8]; /*vector of zeros */ + int k; + H5D_layout_t dset_layout; + hid_t dcpl_tmp = -1; /* dataset creation property list ID */ + + /* check if we have VL data in the dataset's datatype */ + if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* check first if writing dataset is chunked, + * if so use its chunk layout for better performance. */ + dset_layout = H5Pget_layout(dcpl_out); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_out; /* writing dataset */ + else { /* if reading dataset is chunked */ + dset_layout = H5Pget_layout(dcpl_in); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_in; /* reading dataset */ + } + + /* get hyperslab dims and size in byte */ + if (Get_hyperslab(dcpl_tmp, rank, dims, + p_type_nbytes, hslab_dims, + &hslab_nbytes) < 0) + goto error; + + hslab_buf = HDmalloc((size_t)hslab_nbytes); + + hslab_nelmts = hslab_nbytes / p_type_nbytes; + hslab_space = H5Screate_simple(1, &hslab_nelmts, + NULL); + + /* the hyperslab selection loop */ + HDmemset(hs_sel_offset, 0, + sizeof hs_sel_offset); + HDmemset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += + hs_select_nelmts) { + if (rank > 0) { + /* calculate the hyperslab selections. The selection would be same as the hyperslab except for remaining edge portion of the dataset which is smaller then the hyperslab. + */ + for (k = 0, hs_select_nelmts = 1; + k < rank; k++) { + /* MIN() is used to get the remaining edge portion if exist. + * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ + hs_sel_count[k] = + MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); + hs_select_nelmts *= hs_sel_count[k]; + } + + if (H5Sselect_hyperslab(f_space_id, + H5S_SELECT_SET, hs_sel_offset, + NULL, hs_sel_count, NULL) < 0) + goto error; + if (H5Sselect_hyperslab(hslab_space, + H5S_SELECT_SET, zero, NULL, + &hs_select_nelmts, NULL) < 0) + goto error; + } + else { + H5Sselect_all(f_space_id); + H5Sselect_all(hslab_space); + hs_select_nelmts = 1; + } /* rank */ + + /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ + CHECK_H5DRW_ERROR(H5Dread, dset_in, + wtype_id, hslab_space, f_space_id, + H5P_DEFAULT, hslab_buf); + CHECK_H5DRW_ERROR(H5Dwrite, dset_out, + wtype_id, hslab_space, f_space_id, + H5P_DEFAULT, hslab_buf); + + /* reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(wtype_id, hslab_space, + H5P_DEFAULT, hslab_buf); + + /* calculate the next hyperslab offset */ + for (k = rank, carry = 1; k > 0 && carry; + --k) { + hs_sel_offset[k - 1] += hs_sel_count[k + - 1]; + /* if reached the end of a dim */ + if (hs_sel_offset[k - 1] == dims[k - 1]) + hs_sel_offset[k - 1] = 0; + else + carry = 0; + } /* k */ + } /* elmtno */ + + H5Sclose(hslab_space); + /* free */ + if (hslab_buf != NULL) { + HDfree(hslab_buf); + hslab_buf = NULL; + } + } /* hyperslab read */ + } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ + + /*------------------------------------------------------------------------- + * amount of compression used + *------------------------------------------------------------------------- + */ + if (options->verbose) { + double ratio = 0; + + /* only print the compression ration if there was a filter request */ + if (apply_s && apply_f && req_filter) { + /* get the storage size of the output dataset */ + dsize_out = H5Dget_storage_size(dset_out); + + /* compression ratio = uncompressed size / compressed size */ + if (dsize_out != 0) + ratio = (double) dsize_in + / (double) dsize_out; + + print_dataset_info(dcpl_out, + travt->objs[i].name, ratio, 1); + } + else + print_dataset_info(dcpl_in, travt->objs[i].name, + ratio, 0); + + /* print a message that the filter was not applied + (in case there was a filter) + */ + if (has_filter && apply_s == 0) + printf( + " \n", + travt->objs[i].name, + (int) options->min_comp); + + if (has_filter && apply_f == 0) + printf( + " \n", + travt->objs[i].name); + + } /* verbose */ + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(dset_in, dset_out, &named_dt_head, travt, + options) < 0) + goto error; + /*close */ + if (H5Dclose(dset_out) < 0) + goto error; + + }/*!H5T_REFERENCE*/ + }/*h5tools_canreadf*/ + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + if (H5Tclose(ftype_id) < 0) + goto error; + if (H5Tclose(wtype_id) < 0) + goto error; + if (H5Pclose(dcpl_in) < 0) + goto error; + if (H5Pclose(dcpl_out) < 0) + goto error; + if (H5Sclose(f_space_id) < 0) + goto error; + if (H5Dclose(dset_in) < 0) + goto error; + + } + /*------------------------------------------------------------------------- + * we do not have request for filter/chunking use H5Ocopy instead + *------------------------------------------------------------------------- + */ + else { + hid_t pid; + + /* create property to pass copy options */ + if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + goto error; + + /* set options for object copy */ + if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + goto error; + + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + + if (H5Ocopy(fidin, /* Source file or group identifier */ + travt->objs[i].name, /* Name of the source object to be copied */ + fidout, /* Destination file or group identifier */ + travt->objs[i].name, /* Name of the destination object */ + pid, /* Properties which apply to the copy */ + H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ + goto error; + + /* close property */ + if (H5Pclose(pid) < 0) + goto error; + + /*------------------------------------------------------------------------- + * copy attrs manually + *------------------------------------------------------------------------- + */ + if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) + < 0) + goto error; + if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, + H5P_DEFAULT)) < 0) + goto error; + if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) + < 0) + goto error; + if (H5Dclose(dset_in) < 0) + goto error; + if (H5Dclose(dset_out) < 0) + goto error; + + if (options->verbose) + printf(FORMAT_OBJ, "dset", travt->objs[i].name); + + } /* end do we have request for filter/chunking */ + + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_NAMED_DATATYPE + *------------------------------------------------------------------------- + */ + case H5TRAV_TYPE_NAMED_DATATYPE: + + if (options->verbose) + printf(FORMAT_OBJ, "type", travt->objs[i].name); + + if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) + < 0) + goto error; + + /* Copy the datatype anonymously */ + if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, + travt, options)) < 0) + goto error; + + /* Link in to group structure */ + if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, + H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(type_in, type_out, &named_dt_head, travt, options) + < 0) + goto error; + + if (H5Tclose(type_in) < 0) + goto error; + if (H5Tclose(type_out) < 0) + goto error; + + break; + + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_LINK + * H5TRAV_TYPE_UDLINK + * + * Only handles external links; H5Lcopy will fail for other UD link types + * since we don't have creation or copy callbacks for them. + *------------------------------------------------------------------------- + */ + + case H5TRAV_TYPE_LINK: + case H5TRAV_TYPE_UDLINK: { + + if (options->verbose) + printf(FORMAT_OBJ, "link", travt->objs[i].name); + + if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, + H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + + if (options->verbose) + printf(FORMAT_OBJ, "link", travt->objs[i].name); + + } + break; + + default: + goto error; + } /* switch */ + + /* free */ + if (buf != NULL) { + HDfree(buf); + buf = NULL; + } + + } /* i */ + + /* Finalize (link) the stack of named datatypes (if any) */ + named_datatype_free(&named_dt_head, 0); + + return 0; error: - H5E_BEGIN_TRY { - H5Gclose(grp_in); - H5Gclose(grp_out); - H5Pclose(dcpl_in); - H5Pclose(gcpl_in); - H5Pclose(gcpl_out); - H5Sclose(f_space_id); - H5Dclose(dset_in); - H5Dclose(dset_out); - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Tclose(type_in); - H5Tclose(type_out); - named_datatype_free(&named_dt_head, 1); - } H5E_END_TRY; - /* free */ - if (buf!=NULL) - HDfree(buf); - if (hslab_buf!=NULL) - HDfree(hslab_buf); - return -1; + H5E_BEGIN_TRY + { + H5Gclose(grp_in); + H5Gclose(grp_out); + H5Pclose(dcpl_in); + H5Pclose(gcpl_in); + H5Pclose(gcpl_out); + H5Sclose(f_space_id); + H5Dclose(dset_in); + H5Dclose(dset_out); + H5Tclose(ftype_id); + H5Tclose(wtype_id); + H5Tclose(type_in); + H5Tclose(type_out); + named_datatype_free(&named_dt_head, 1); + }H5E_END_TRY; + /* free */ + if (buf != NULL) + HDfree(buf); + if (hslab_buf != NULL) + HDfree(hslab_buf); + return -1; } - /*------------------------------------------------------------------------- -* Function: print_dataset_info -* -* Purpose: print name, filters, percentage compression of a dataset -* -*------------------------------------------------------------------------- -*/ -static void print_dataset_info(hid_t dcpl_id, - char *objname, - double ratio, - int pr) -{ - char strfilter[255]; + * Function: print_dataset_info + * + * Purpose: print name, filters, percentage compression of a dataset + * + *------------------------------------------------------------------------- + */ +static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, + int pr) { + char strfilter[255]; #if defined (PRINT_DEBUG ) - char temp[255]; + char temp[255]; #endif - int nfilters; /* number of filters */ - unsigned filt_flags; /* filter flags */ - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[20]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ - char f_objname[256]; /* filter objname */ - int i; + int nfilters; /* number of filters */ + unsigned filt_flags; /* filter flags */ + H5Z_filter_t filtn; /* filter identification number */ + unsigned cd_values[20]; /* filter client data values */ + size_t cd_nelmts; /* filter client number of values */ + char f_objname[256]; /* filter objname */ + int i; + HDstrcpy(strfilter, "\0"); - HDstrcpy(strfilter,"\0"); + /* get information about input filters */ + if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) + return; - /* get information about input filters */ - if((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - return; + for (i = 0; i < nfilters; i++) { + cd_nelmts = NELMTS(cd_values); - for(i = 0; i < nfilters; i++) { - cd_nelmts = NELMTS(cd_values); + filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_objname), f_objname, NULL); - filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_objname), f_objname, NULL); + switch (filtn) { - switch(filtn) { - default: - break; + case H5Z_FILTER_NONE: + HDstrcat(strfilter, "NONE "); + break; - case H5Z_FILTER_DEFLATE: - HDstrcat(strfilter,"GZIP "); + case H5Z_FILTER_DEFLATE: + HDstrcat(strfilter, "GZIP "); #if defined (PRINT_DEBUG) - { - unsigned level=cd_values[0]; - sprintf(temp,"(%d)",level); - HDstrcat(strfilter,temp); - } + { + unsigned level=cd_values[0]; + sprintf(temp,"(%d)",level); + HDstrcat(strfilter,temp); + } #endif - break; + break; - case H5Z_FILTER_SZIP: - HDstrcat(strfilter,"SZIP "); + case H5Z_FILTER_SZIP: + HDstrcat(strfilter, "SZIP "); #if defined (PRINT_DEBUG) - { - unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ - unsigned ppb=cd_values[1]; - sprintf(temp,"(%d,",ppb); - HDstrcat(strfilter,temp); - if (options_mask & H5_SZIP_EC_OPTION_MASK) - HDstrcpy(temp,"EC) "); - else if (options_mask & H5_SZIP_NN_OPTION_MASK) - HDstrcpy(temp,"NN) "); - } - HDstrcat(strfilter,temp); + { + unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ + unsigned ppb=cd_values[1]; + sprintf(temp,"(%d,",ppb); + HDstrcat(strfilter,temp); + if (options_mask & H5_SZIP_EC_OPTION_MASK) + HDstrcpy(temp,"EC) "); + else if (options_mask & H5_SZIP_NN_OPTION_MASK) + HDstrcpy(temp,"NN) "); + } + HDstrcat(strfilter,temp); #endif - break; - - case H5Z_FILTER_SHUFFLE: - HDstrcat(strfilter,"SHUF "); - break; - - case H5Z_FILTER_FLETCHER32: - HDstrcat(strfilter,"FLET "); - break; - - case H5Z_FILTER_NBIT: - HDstrcat(strfilter,"NBIT "); - break; - - case H5Z_FILTER_SCALEOFFSET: - HDstrcat(strfilter,"SCALEOFFSET "); - break; - } /* switch */ - }/*i*/ - - if(!pr) - printf(FORMAT_OBJ,"dset",objname ); - else - { - char str[255], temp[28]; - HDstrcpy(str,"dset "); - HDstrcat(str,strfilter); - sprintf(temp," (%.3f:1)",ratio); - HDstrcat(str,temp); - printf(FORMAT_OBJ,str,objname); - } + break; + + case H5Z_FILTER_SHUFFLE: + HDstrcat(strfilter, "SHUF "); + break; + + case H5Z_FILTER_FLETCHER32: + HDstrcat(strfilter, "FLET "); + break; + + case H5Z_FILTER_NBIT: + HDstrcat(strfilter, "NBIT "); + break; + + case H5Z_FILTER_SCALEOFFSET: + HDstrcat(strfilter, "SCALEOFFSET "); + break; + + default: + HDstrcat(strfilter, "UD "); + break; + } /* switch */ + }/*i*/ + + if (!pr) + printf(FORMAT_OBJ, "dset", objname); + else { + char str[255], temp[28]; + HDstrcpy(str, "dset "); + HDstrcat(str, strfilter); + sprintf(temp, " (%.3f:1)", ratio); + HDstrcat(str, temp); + printf(FORMAT_OBJ, str, objname); + } } - /*------------------------------------------------------------------------- -* Function: copy_user_block -* -* Purpose: copy user block from one file to another -* -* Return: 0, ok, -1 no -* -* Programmer: Peter Cao -* -* Date: October, 25, 2007 -* -*------------------------------------------------------------------------- -*/ -static int -copy_user_block(const char *infile, const char *outfile, hsize_t size) -{ - int infid = -1, outfid = -1; /* File descriptors */ - int status = 0; /* Return value */ - - /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ - HDassert(size > 0); - - /* Open files */ - if((infid = HDopen(infile, O_RDONLY, 0)) < 0) { - status = -1; - goto done; - } - if((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) { - status = -1; - goto done; - } - - /* Copy the userblock from the input file to the output file */ - while(size > 0) { - ssize_t nread, nbytes; /* # of bytes transfered, etc. */ - char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */ - const char *wbuf; /* Pointer into buffer, for writing */ - - /* Read buffer from source file */ - if(size > USERBLOCK_XFER_SIZE) - nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(infid, rbuf, (size_t)size); - if(nread < 0) { - status = -1; - goto done; - } /* end if */ - - /* Write buffer to destination file */ - /* (compensating for interrupted writes & checking for errors, etc.) */ - nbytes = nread; - wbuf = rbuf; - while(nbytes > 0) { - ssize_t nwritten; /* # of bytes written */ - - do { - nwritten = HDwrite(outfid, wbuf, (size_t)nbytes); - } while(-1 == nwritten && EINTR == errno); - if(-1 == nwritten) { /* error */ - status = -1; - goto done; - } /* end if */ - HDassert(nwritten > 0); - HDassert(nwritten <= nbytes); - - /* Update # of bytes left & offset in buffer */ - nbytes -= nwritten; - wbuf += nwritten; - HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); - } /* end while */ - - /* Update size of userblock left to transfer */ - size = size - (hsize_t)nread; - } /* end while */ + * Function: copy_user_block + * + * Purpose: copy user block from one file to another + * + * Return: 0, ok, -1 no + * + * Programmer: Peter Cao + * + * Date: October, 25, 2007 + * + *------------------------------------------------------------------------- + */ +static int copy_user_block(const char *infile, const char *outfile, + hsize_t size) { + int infid = -1, outfid = -1; /* File descriptors */ + int status = 0; /* Return value */ + + /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ + HDassert(size > 0); + + /* Open files */ + if ((infid = HDopen(infile, O_RDONLY, 0)) < 0) { + status = -1; + goto done; + } + if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) { + status = -1; + goto done; + } + + /* Copy the userblock from the input file to the output file */ + while (size > 0) { + ssize_t nread, nbytes; /* # of bytes transfered, etc. */ + char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */ + const char *wbuf; /* Pointer into buffer, for writing */ + + /* Read buffer from source file */ + if (size > USERBLOCK_XFER_SIZE) + nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE); + else + nread = HDread(infid, rbuf, (size_t)size); + if (nread < 0) { + status = -1; + goto done; + } /* end if */ + + /* Write buffer to destination file */ + /* (compensating for interrupted writes & checking for errors, etc.) */ + nbytes = nread; + wbuf = rbuf; + while (nbytes > 0) { + ssize_t nwritten; /* # of bytes written */ + + do { + nwritten = HDwrite(outfid, wbuf, (size_t)nbytes); + } while (-1 == nwritten && EINTR == errno); + if (-1 == nwritten) { /* error */ + status = -1; + goto done; + } /* end if */ + HDassert(nwritten > 0); + HDassert(nwritten <= nbytes); + + /* Update # of bytes left & offset in buffer */ + nbytes -= nwritten; + wbuf += nwritten; + HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); + } /* end while */ + + /* Update size of userblock left to transfer */ + size = size - (hsize_t) nread; + } /* end while */ done: - if(infid > 0) - HDclose(infid); - if(outfid > 0) - HDclose(outfid); + if (infid > 0) + HDclose(infid); + if (outfid > 0) + HDclose(outfid); - return status; + return status; } - - /*------------------------------------------------------------------------- -* Function: print_user_block -* -* Purpose: print user block -* -* Return: 0, ok, -1 no -* -* Programmer: Pedro Vicente -* -* Date: August, 20, 2008 -* -*------------------------------------------------------------------------- -*/ + * Function: print_user_block + * + * Purpose: print user block + * + * Return: 0, ok, -1 no + * + * Programmer: Pedro Vicente + * + * Date: August, 20, 2008 + * + *------------------------------------------------------------------------- + */ #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid) { - int fh; /* file handle */ - hsize_t ub_size; /* user block size */ - hsize_t size; /* size read */ - hid_t fcpl; /* file creation property list ID for HDF5 file */ - int i; - - /* get user block size */ - if(( fcpl = H5Fget_create_plist(fid)) < 0) - { - error_msg("failed to retrieve file creation property list\n"); - goto done; - } - - if(H5Pget_userblock(fcpl, &ub_size) < 0) - { - error_msg("failed to retrieve userblock size\n"); - goto done; - } - - if(H5Pclose(fcpl) < 0) - { - error_msg("failed to close property list\n"); - goto done; - } - - /* open file */ - if((fh = HDopen(filename, O_RDONLY, 0)) < 0) - { - goto done; - } - - size = ub_size; - - /* read file */ - while(size > 0) - { - ssize_t nread; /* # of bytes read */ - char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ - - /* read buffer */ - if(size > USERBLOCK_XFER_SIZE) - nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE); - else - nread = HDread(fh, rbuf, (size_t)size); - - for(i = 0; i < nread; i++) - { - - printf("%c ", rbuf[i]); - - } - printf("\n"); - - if(nread < 0) - { - goto done; - } - - - /* update size of userblock left to transfer */ - size -= nread; - } + int fh; /* file handle */ + hsize_t ub_size; /* user block size */ + hsize_t size; /* size read */ + hid_t fcpl; /* file creation property list ID for HDF5 file */ + int i; -done: - if(fh > 0) - HDclose(fh); + /* get user block size */ + if(( fcpl = H5Fget_create_plist(fid)) < 0) { + error_msg("failed to retrieve file creation property list\n"); + goto done; + } + + if(H5Pget_userblock(fcpl, &ub_size) < 0) { + error_msg("failed to retrieve userblock size\n"); + goto done; + } + + if(H5Pclose(fcpl) < 0) { + error_msg("failed to close property list\n"); + goto done; + } + + /* open file */ + if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { + goto done; + } + size = ub_size; + + /* read file */ + while(size > 0) { + ssize_t nread; /* # of bytes read */ + char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ + + /* read buffer */ + if(size > USERBLOCK_XFER_SIZE) + nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE); + else + nread = HDread(fh, rbuf, (size_t)size); + + for(i = 0; i < nread; i++) { + + printf("%c ", rbuf[i]); + + } + printf("\n"); + + if(nread < 0) { + goto done; + } + + /* update size of userblock left to transfer */ + size -= nread; + } + +done: + if(fh > 0) + HDclose(fh); - return; + return; } #endif diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 6c7bc65..56e08ef 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -345,8 +345,13 @@ int apply_filters(const char* name, /* object name from traverse list */ { switch (obj.filter[i].filtn) { - default: - break; + + /*------------------------------------------------------------------------- + * H5Z_FILTER_NONE 0 , uncompress if compressed + *------------------------------------------------------------------------- + */ + case H5Z_FILTER_NONE: + break; /*------------------------------------------------------------------------- * H5Z_FILTER_DEFLATE 1 , deflation like gzip @@ -436,6 +441,14 @@ int apply_filters(const char* name, /* object name from traverse list */ return -1; } break; + default: + { + if (H5Pset_filter (dcpl_id, obj.filter[i].filtn, H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts, obj.filter[i].cd_values)<0) + return -1; + if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) + return -1; + } + break; } /* switch */ }/*i*/ diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 05ff447..d7bfd02 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -20,259 +20,346 @@ /* Name of tool */ #define PROGRAMNAME "h5repack" -static void usage(const char *prog); -static void parse_command_line(int argc, const char **argv, pack_opt_t* options); -static void read_info(const char *filename,pack_opt_t *options); - +static int parse_command_line(int argc, const char **argv, pack_opt_t* options); /* module-scoped variables */ -static int has_i_o = 0; -const char *infile = NULL; -const char *outfile = NULL; - +static int has_i_o = 0; +const char *infile = NULL; +const char *outfile = NULL; /* * Command-line options: The user can specify short or long-named * parameters. */ static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:"; -static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "version", no_arg, 'V' }, - { "verbose", no_arg, 'v' }, - { "filter", require_arg, 'f' }, - { "layout", require_arg, 'l' }, - { "minimum", require_arg, 'm' }, - { "file", require_arg, 'e' }, - { "native", no_arg, 'n' }, - { "latest", no_arg, 'L' }, - { "compact", require_arg, 'c' }, - { "indexed", require_arg, 'd' }, - { "ssize", require_arg, 's' }, - { "ublock", require_arg, 'u' }, - { "block", require_arg, 'b' }, - { "metadata_block_size", require_arg, 'M' }, - { "threshold", require_arg, 't' }, - { "alignment", require_arg, 'a' }, - { "infile", require_arg, 'i' }, /* -i for backward compability */ - { "outfile", require_arg, 'o' }, /* -o for backward compability */ - { "fs_strategy", require_arg, 'S' }, - { "fs_threshold", require_arg, 'T' }, - { NULL, 0, '\0' } -}; - - - +static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", + no_arg, 'V' }, { "verbose", no_arg, 'v' }, + { "filter", require_arg, 'f' }, { "layout", require_arg, 'l' }, { + "minimum", require_arg, 'm' }, { "file", require_arg, 'e' }, { + "native", no_arg, 'n' }, { "latest", no_arg, 'L' }, { "compact", + require_arg, 'c' }, { "indexed", require_arg, 'd' }, { "ssize", + require_arg, 's' }, { "ublock", require_arg, 'u' }, { "block", + require_arg, 'b' }, { "metadata_block_size", require_arg, 'M' }, + { "threshold", require_arg, 't' }, { "alignment", require_arg, 'a' }, { + "infile", require_arg, 'i' }, /* -i for backward compability */ + { "outfile", require_arg, 'o' }, /* -o for backward compability */ + { "fs_strategy", require_arg, 'S' }, + { "fs_threshold", require_arg, 'T' }, { NULL, 0, '\0' } }; /*------------------------------------------------------------------------- - * Function: main + * Function: usage * - * Purpose: h5repack main program + * Purpose: print usage * - * Return: Success: EXIT_SUCCESS(0) + * Return: void * - * Failure: EXIT_FAILURE(1) + *------------------------------------------------------------------------- + */ +static void usage(const char *prog) { + printf("usage: %s [OPTIONS] file1 file2\n", prog); + printf(" file1 Input HDF5 File\n"); + printf(" file2 Output HDF5 File\n"); + printf(" OPTIONS\n"); + printf(" -h, --help Print a usage message and exit\n"); + printf( + " -v, --verbose Verbose mode, print object information\n"); + printf(" -V, --version Print version number and exit\n"); + printf( + " -n, --native Use a native HDF5 type when repacking\n"); + printf(" -L, --latest Use latest version of file format\n"); + printf( + " -c L1, --compact=L1 Maximum number of links in header messages\n"); + printf( + " -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); + printf( + " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); + printf( + " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); + printf( + " -e E, --file=E Name of file E with the -f and -l options\n"); + printf( + " -u U, --ublock=U Name of file U with user block data to be added\n"); + printf(" -b B, --block=B Size of user block to be added\n"); + printf( + " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); + printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n"); + printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); + printf(" -f FILT, --filter=FILT Filter type\n"); + printf(" -l LAYT, --layout=LAYT Layout type\n"); + printf( + " -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); + printf( + " -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); + + printf("\n"); + + printf( + " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); + printf(" E - is a filename.\n"); + printf(" S - is an integer\n"); + printf(" U - is a filename.\n"); + printf(" T - is an integer\n"); + printf(" A - is an integer greater than zero\n"); + printf( + " B - is the user block size, any value that is 512 or greater and is\n"); + printf(" a power of 2 (1024 default)\n"); + printf( + " F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); + printf("\n"); + printf( + " FS_STRGY is the file space management strategy to use for the output file.\n"); + printf(" It is a string as listed below:\n"); + printf( + " ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); + printf(" for file space allocation\n"); + printf( + " ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); + printf(" for file space allocation\n"); + printf( + " AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); + printf(" VFD - Use virtual file driver for file space allocation\n"); + printf("\n"); + printf( + " FS_THRD is the free-space section threshold to use for the output file.\n"); + printf( + " It is the minimum size (in bytes) of free-space sections to be tracked\n"); + printf(" by the the library's free-space managers.\n"); + printf("\n"); + + printf(" FILT - is a string with the format:\n"); + printf("\n"); + printf(" :=\n"); + printf("\n"); + printf( + " is a comma separated list of object names, meaning apply\n"); + printf( + " compression only to those objects. If no names are specified, the filter\n"); + printf(" is applied to all objects\n"); + printf(" can be:\n"); + printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); + printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n"); + printf(" SHUF, to apply the HDF5 shuffle filter\n"); + printf(" FLET, to apply the HDF5 checksum filter\n"); + printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); + printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); + printf(" UD, to apply a user defined filter\n"); + printf(" NONE, to remove all filters\n"); + printf( + " is optional filter parameter information\n"); + printf(" GZIP= from 1-9\n"); + printf( + " SZIP= pixels per block is a even number in\n"); + printf(" 2-32 and coding method is either EC or NN\n"); + printf(" SHUF (no parameter)\n"); + printf(" FLET (no parameter)\n"); + printf(" NBIT (no parameter)\n"); + printf( + " SOFF= scale_factor is an integer and scale_type\n"); + printf(" is either IN or DS\n"); + printf( + " UD=\n"); + printf( + " required values for filter_number,cd_value_count,value_1\n"); + printf(" optional values for value_2 to value_N\n"); + printf(" NONE (no parameter)\n"); + printf("\n"); + printf(" LAYT - is a string with the format:\n"); + printf("\n"); + printf(" :=\n"); + printf("\n"); + printf( + " is a comma separated list of object names, meaning that\n"); + printf( + " layout information is supplied for those objects. If no names are\n"); + printf(" specified, the layout type is applied to all objects\n"); + printf(" can be:\n"); + printf(" CHUNK, to apply chunking layout\n"); + printf(" COMPA, to apply compact layout\n"); + printf(" CONTI, to apply contiguous layout\n"); + printf(" is optional layout information\n"); + printf( + " CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); + printf(" COMPA (no parameter)\n"); + printf(" CONTI (no parameter)\n"); + printf("\n"); + printf("Examples of use:\n"); + printf("\n"); + printf("1) h5repack -v -f GZIP=1 file1 file2\n"); + printf("\n"); + printf(" GZIP compression with level 1 to all objects\n"); + printf("\n"); + printf("2) h5repack -v -f A:SZIP=8,NN file1 file2\n"); + printf("\n"); + printf( + " SZIP compression with 8 pixels per block and NN coding method to object A\n"); + printf("\n"); + printf("3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2\n"); + printf("\n"); + printf( + " Chunked layout, with a layout size of 20x10, to objects A and B\n"); + printf(" and remove filters to objects C, D, F\n"); + printf("\n"); + printf("4) h5repack -L -c 10 -s 20:dtype file1 file2 \n"); + printf("\n"); + printf( + " Using latest file format with maximum compact group size of 10 and\n"); + printf(" and minimum shared datatype size of 20\n"); + printf("\n"); + printf("5) h5repack -f SHUF -f GZIP=1 file1 file2 \n"); + printf("\n"); + printf(" Add both filters SHUF and GZIP in this order to all datasets\n"); + printf("\n"); + printf("6) h5repack -f UD=307,1,9 file1 file2 \n"); + printf("\n"); + printf(" Add bzip2 filter to all datasets\n"); + printf("\n"); +} + + +/*------------------------------------------------------------------------- + * Function: leave * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Purpose: Shutdown MPI & HDF5 and call exit() * - * Date: May 9, 2003 + * Return: Does not return * - * Comments: + * Programmer: Quincey Koziol + * Saturday, 31. January 2004 + * + * Modifications: * *------------------------------------------------------------------------- */ -int main(int argc, const char **argv) -{ - - pack_opt_t options; /*the global options */ - int ret=-1; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ - if ( h5tools_getenv_update_hyperslab_bufsize() < 0) - HDexit(EXIT_FAILURE); - - /* initialize options */ - h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0); - - parse_command_line(argc, argv, &options); - - /* get file names if they were not yet got */ - if ( has_i_o == 0 ) - { - - if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) - { - infile = argv[ opt_ind ]; - outfile = argv[ opt_ind + 1 ]; - - if ( HDstrcmp( infile, outfile ) == 0 ) - { - error_msg("file names cannot be the same\n"); - usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); - - } - } - - else - { - error_msg("file names missing\n"); - usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); - } - } - - - /* pack it */ - ret=h5repack(infile,outfile,&options); +static void leave(int ret) { + h5tools_close(); - /* free tables */ - h5repack_end(&options); - - if (ret==-1) - return 1; - else - return 0; + HDexit(ret); } - - /*------------------------------------------------------------------------- - * Function: usage + * Function: read_info * - * Purpose: print usage + * Purpose: read comp and chunk options from a file * - * Return: void + * Return: void, exit on error + * + * Programmer: pvn@ncsa.uiuc.edu + * + * Date: September, 22, 2003 * *------------------------------------------------------------------------- */ -static void usage(const char *prog) -{ - printf("usage: %s [OPTIONS] file1 file2\n", prog); - printf(" file1 Input HDF5 File\n"); - printf(" file2 Output HDF5 File\n"); - printf(" OPTIONS\n"); - printf(" -h, --help Print a usage message and exit\n"); - printf(" -v, --verbose Verbose mode, print object information\n"); - printf(" -V, --version Print version number and exit\n"); - printf(" -n, --native Use a native HDF5 type when repacking\n"); - printf(" -L, --latest Use latest version of file format\n"); - printf(" -c L1, --compact=L1 Maximum number of links in header messages\n"); - printf(" -d L2, --indexed=L2 Minimum number of links in the indexed format\n"); - printf(" -s S[:F], --ssize=S[:F] Shared object header message minimum size\n"); - printf(" -m M, --minimum=M Do not apply the filter to datasets smaller than M\n"); - printf(" -e E, --file=E Name of file E with the -f and -l options\n"); - printf(" -u U, --ublock=U Name of file U with user block data to be added\n"); - printf(" -b B, --block=B Size of user block to be added\n"); - printf(" -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); - printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n"); - printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); - printf(" -f FILT, --filter=FILT Filter type\n"); - printf(" -l LAYT, --layout=LAYT Layout type\n"); - printf(" -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n"); - printf(" -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n"); - - printf("\n"); - - printf(" M - is an integer greater than 1, size of dataset in bytes (default is 0) \n"); - printf(" E - is a filename.\n"); - printf(" S - is an integer\n"); - printf(" U - is a filename.\n"); - printf(" T - is an integer\n"); - printf(" A - is an integer greater than zero\n"); - printf(" B - is the user block size, any value that is 512 or greater and is\n"); - printf(" a power of 2 (1024 default)\n"); - printf(" F - is the shared object header message type, any of . If F is not specified, S applies to all messages\n"); - printf("\n"); - printf(" FS_STRGY is the file space management strategy to use for the output file.\n"); - printf(" It is a string as listed below:\n"); - printf(" ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n"); - printf(" for file space allocation\n"); - printf(" ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n"); - printf(" for file space allocation\n"); - printf(" AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n"); - printf(" VFD - Use virtual file driver for file space allocation\n"); - printf("\n"); - printf(" FS_THRD is the free-space section threshold to use for the output file.\n"); - printf(" It is the minimum size (in bytes) of free-space sections to be tracked\n"); - printf(" by the the library's free-space managers.\n"); - printf("\n"); - - printf(" FILT - is a string with the format:\n"); - printf("\n"); - printf(" :=\n"); - printf("\n"); - printf(" is a comma separated list of object names, meaning apply\n"); - printf(" compression only to those objects. If no names are specified, the filter\n"); - printf(" is applied to all objects\n"); - printf(" can be:\n"); - printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n"); - printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n"); - printf(" SHUF, to apply the HDF5 shuffle filter\n"); - printf(" FLET, to apply the HDF5 checksum filter\n"); - printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n"); - printf(" SOFF, to apply the HDF5 Scale/Offset filter\n"); - printf(" NONE, to remove all filters\n"); - printf(" is optional filter parameter information\n"); - printf(" GZIP= from 1-9\n"); - printf(" SZIP= pixels per block is a even number in\n"); - printf(" 2-32 and coding method is either EC or NN\n"); - printf(" SHUF (no parameter)\n"); - printf(" FLET (no parameter)\n"); - printf(" NBIT (no parameter)\n"); - printf(" SOFF= scale_factor is an integer and scale_type\n"); - printf(" is either IN or DS\n"); - printf(" NONE (no parameter)\n"); - printf("\n"); - printf(" LAYT - is a string with the format:\n"); - printf("\n"); - printf(" :=\n"); - printf("\n"); - printf(" is a comma separated list of object names, meaning that\n"); - printf(" layout information is supplied for those objects. If no names are\n"); - printf(" specified, the layout type is applied to all objects\n"); - printf(" can be:\n"); - printf(" CHUNK, to apply chunking layout\n"); - printf(" COMPA, to apply compact layout\n"); - printf(" CONTI, to apply contiguous layout\n"); - printf(" is optional layout information\n"); - printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n"); - printf(" COMPA (no parameter)\n"); - printf(" CONTI (no parameter)\n"); - printf("\n"); - printf("Examples of use:\n"); - printf("\n"); - printf("1) h5repack -v -f GZIP=1 file1 file2\n"); - printf("\n"); - printf(" GZIP compression with level 1 to all objects\n"); - printf("\n"); - printf("2) h5repack -v -f A:SZIP=8,NN file1 file2\n"); - printf("\n"); - printf(" SZIP compression with 8 pixels per block and NN coding method to object A\n"); - printf("\n"); - printf("3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2\n"); - printf("\n"); - printf(" Chunked layout, with a layout size of 20x10, to objects A and B\n"); - printf(" and remove filters to objects C, D, F\n"); - printf("\n"); - printf("4) h5repack -L -c 10 -s 20:dtype file1 file2 \n"); - printf("\n"); - printf(" Using latest file format with maximum compact group size of 10 and\n"); - printf(" and minimum shared datatype size of 20\n"); - printf("\n"); - printf("5) h5repack -f SHUF -f GZIP=1 file1 file2 \n"); - printf("\n"); - printf(" Add both filters SHUF and GZIP in this order to all datasets\n"); - printf("\n"); -} +static +int read_info(const char *filename, pack_opt_t *options) { + + char stype[10]; + char comp_info[1024]; + FILE *fp = NULL; + char c; + int i, rc = 1; + int ret_value = EXIT_SUCCESS; + + if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) { + error_msg("cannot open options file %s\n", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + + /* cycle until end of file reached */ + while (1) { + rc = fscanf(fp, "%s", stype); + if (rc == -1) + break; + + /*------------------------------------------------------------------------- + * filter + *------------------------------------------------------------------------- + */ + if (HDstrcmp(stype,"-f") == 0) { + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + fscanf(fp, "%c", &c); + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + fscanf(fp, "%c", &c); + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ + + if (h5repack_addfilter(comp_info, options) == -1) { + error_msg("could not add compression option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * layout + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(stype,"-l") == 0) { + + /* find begining of info */ + i = 0; + c = '0'; + while (c != ' ') { + fscanf(fp, "%c", &c); + if (HDfeof(fp)) + break; + } + c = '0'; + /* go until end */ + while (c != ' ') { + fscanf(fp, "%c", &c); + comp_info[i] = c; + i++; + if (HDfeof(fp)) + break; + if (c == 10 /*eol*/) + break; + } + comp_info[i - 1] = '\0'; /*cut the last " */ + + if (h5repack_addlayout(comp_info, options) == -1) { + error_msg("could not add chunck option\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + /*------------------------------------------------------------------------- + * not valid + *------------------------------------------------------------------------- + */ + else { + error_msg("bad file format for %s", filename); + h5tools_setstatus(EXIT_FAILURE); + ret_value = EXIT_FAILURE; + goto done; + } + } + +done: + if (fp) + HDfclose(fp); + + return ret_value; +} /*------------------------------------------------------------------------- * Function: parse_command_line @@ -283,306 +370,275 @@ static void usage(const char *prog) */ static -void parse_command_line(int argc, const char **argv, pack_opt_t* options) -{ - - int opt; - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char)opt) - { - - /* -i for backward compability */ - case 'i': - infile = opt_arg; - has_i_o = 1; - break; - /* -o for backward compability */ - case 'o': - outfile = opt_arg; - has_i_o = 1; - break; - - - case 'h': - usage(h5tools_getprogname()); - HDexit(EXIT_SUCCESS); - case 'V': - print_version(h5tools_getprogname()); - HDexit(EXIT_SUCCESS); - case 'v': - options->verbose = 1; - break; - case 'f': - - /* parse the -f filter option */ - if (h5repack_addfilter( opt_arg, options)<0) - { - error_msg("in parsing filter\n"); - HDexit(EXIT_FAILURE); - } - break; - case 'l': - - /* parse the -l layout option */ - if (h5repack_addlayout( opt_arg, options)<0) - { - error_msg("in parsing layout\n"); - HDexit(EXIT_FAILURE); - } - break; - - - case 'm': - - options->min_comp = HDatoi( opt_arg ); - if ((int)options->min_comp<=0) - { - error_msg("invalid minimum compress size <%s>\n", opt_arg ); - HDexit(EXIT_FAILURE); - } - break; - - case 'e': - read_info( opt_arg, options); - break; - - case 'n': - options->use_native = 1; - break; - - case 'L': - options->latest = TRUE; - break; - - case 'c': - options->grp_compact = HDatoi( opt_arg ); - if (options->grp_compact > 0) - options->latest = TRUE; /* must use latest format */ - break; - - - case 'd': - options->grp_indexed = HDatoi( opt_arg ); - if (options->grp_indexed > 0) - options->latest = TRUE; /* must use latest format */ - break; - - case 's': - { - int idx = 0; - int ssize = 0; - char *msgPtr = HDstrchr(opt_arg, ':'); - options->latest = TRUE; /* must use latest format */ - if (msgPtr == NULL) - { - ssize = HDatoi( opt_arg ); - for(idx = 0; idx < 5; idx++) - options->msg_size[idx] = ssize; - } - else - { - char msgType[10]; - HDstrcpy(msgType, msgPtr+1); - msgPtr[0] = '\0'; - ssize = HDatoi( opt_arg ); - if(HDstrncmp(msgType, "dspace",6) == 0) - options->msg_size[0] = ssize; - else if (HDstrncmp(msgType, "dtype", 5) == 0) - options->msg_size[1] = ssize; - else if (HDstrncmp(msgType, "fill", 4) == 0) - options->msg_size[2] = ssize; - else if (HDstrncmp(msgType, "pline", 5) == 0) - options->msg_size[3] = ssize; - else if (HDstrncmp(msgType, "attr", 4) == 0) - options->msg_size[4] = ssize; - } - } - break; - - case 'u': - - options->ublock_filename = opt_arg; - break; - - case 'b': - - options->ublock_size = (hsize_t)HDatol( opt_arg ); - break; - - case 'M': - - options->meta_block_size = (hsize_t)HDatol( opt_arg ); - break; - - case 't': - - options->threshold = (hsize_t)HDatol( opt_arg ); - break; - - case 'a': - - options->alignment = HDatol( opt_arg ); - if ( options->alignment < 1 ) - { - error_msg("invalid alignment size\n", opt_arg ); - HDexit(EXIT_FAILURE); - } - break; - - case 'S': - { - char strategy[MAX_NC_NAME]; - - HDstrcpy(strategy, opt_arg); - if(!HDstrcmp(strategy, "ALL_PERSIST")) - options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; - else if(!HDstrcmp(strategy, "ALL")) - options->fs_strategy = H5F_FILE_SPACE_ALL; - else if(!HDstrcmp(strategy, "AGGR_VFD")) - options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; - else if(!HDstrcmp(strategy, "VFD")) - options->fs_strategy = H5F_FILE_SPACE_VFD; - else { - error_msg("invalid file space management strategy\n", opt_arg ); - HDexit(EXIT_FAILURE); - } - break; - } - - case 'T': - - options->fs_threshold = (hsize_t)HDatol( opt_arg ); - break; - default: - break; - } /* switch */ - - - } /* while */ - - if ( has_i_o == 0 ) - { - /* check for file names to be processed */ - if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) - { - error_msg("missing file names\n"); - usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); - } - } - +int parse_command_line(int argc, const char **argv, pack_opt_t* options) { + + int opt; + int ret_value = 0; + + /* parse command line options */ + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + switch ((char) opt) { + + /* -i for backward compability */ + case 'i': + infile = opt_arg; + has_i_o = 1; + break; + + /* -o for backward compability */ + case 'o': + outfile = opt_arg; + has_i_o = 1; + break; + + case 'h': + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; + + case 'V': + print_version(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + ret_value = -1; + goto done; + + case 'v': + options->verbose = 1; + break; + + case 'f': + /* parse the -f filter option */ + if (h5repack_addfilter(opt_arg, options) < 0) { + error_msg("in parsing filter\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'l': + /* parse the -l layout option */ + if (h5repack_addlayout(opt_arg, options) < 0) { + error_msg("in parsing layout\n"); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'm': + options->min_comp = HDatoi( opt_arg ); + if ((int) options->min_comp <= 0) { + error_msg("invalid minimum compress size <%s>\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'e': + ret_value = read_info(opt_arg, options); + if (ret_value < 0) + goto done; + break; + + case 'n': + options->use_native = 1; + break; + + case 'L': + options->latest = TRUE; + break; + + case 'c': + options->grp_compact = HDatoi( opt_arg ); + if (options->grp_compact > 0) + options->latest = TRUE; /* must use latest format */ + break; + + case 'd': + options->grp_indexed = HDatoi( opt_arg ); + if (options->grp_indexed > 0) + options->latest = TRUE; /* must use latest format */ + break; + + case 's': + { + int idx = 0; + int ssize = 0; + char *msgPtr = HDstrchr( opt_arg, ':'); + options->latest = TRUE; /* must use latest format */ + if (msgPtr == NULL) { + ssize = HDatoi( opt_arg ); + for (idx = 0; idx < 5; idx++) + options->msg_size[idx] = ssize; + } + else { + char msgType[10]; + HDstrcpy(msgType, msgPtr + 1); + msgPtr[0] = '\0'; + ssize = HDatoi( opt_arg ); + if (HDstrncmp(msgType, "dspace",6) == 0) { + options->msg_size[0] = ssize; + } + else if (HDstrncmp(msgType, "dtype", 5) == 0) { + options->msg_size[1] = ssize; + } + else if (HDstrncmp(msgType, "fill", 4) == 0) { + options->msg_size[2] = ssize; + } + else if (HDstrncmp(msgType, "pline", 5) == 0) { + options->msg_size[3] = ssize; + } + else if (HDstrncmp(msgType, "attr", 4) == 0) { + options->msg_size[4] = ssize; + } + } + } + break; + + case 'u': + options->ublock_filename = opt_arg; + break; + + case 'b': + options->ublock_size = (hsize_t) HDatol( opt_arg ); + break; + + case 'M': + options->meta_block_size = (hsize_t) HDatol( opt_arg ); + break; + + case 't': + options->threshold = (hsize_t) HDatol( opt_arg ); + break; + + case 'a': + options->alignment = HDatol( opt_arg ); + if (options->alignment < 1) { + error_msg("invalid alignment size\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + break; + + case 'S': + { + char strategy[MAX_NC_NAME]; + + HDstrcpy(strategy, opt_arg); + if (!HDstrcmp(strategy, "ALL_PERSIST")) + options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST; + else if (!HDstrcmp(strategy, "ALL")) + options->fs_strategy = H5F_FILE_SPACE_ALL; + else if (!HDstrcmp(strategy, "AGGR_VFD")) + options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD; + else if (!HDstrcmp(strategy, "VFD")) + options->fs_strategy = H5F_FILE_SPACE_VFD; + else { + error_msg("invalid file space management strategy\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + goto done; + } + } + break; + + case 'T': + options->fs_threshold = (hsize_t) HDatol( opt_arg ); + break; + + default: + break; + } /* switch */ + + } /* while */ + + if (has_i_o == 0) { + /* check for file names to be processed */ + if (argc <= opt_ind || argv[opt_ind + 1] == NULL) { + error_msg("missing file names\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; + } + } + +done: + return ret_value; } /*------------------------------------------------------------------------- - * Function: read_info + * Function: main * - * Purpose: read comp and chunk options from a file + * Purpose: h5repack main program * - * Return: void, exit on error + * Return: Success: EXIT_SUCCESS(0) * - * Programmer: pvn@ncsa.uiuc.edu + * Failure: EXIT_FAILURE(1) * - * Date: September, 22, 2003 + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: May 9, 2003 + * + * Comments: * *------------------------------------------------------------------------- */ - -static -void read_info(const char *filename, - pack_opt_t *options) -{ - - char stype[10]; - char comp_info[1024]; - FILE *fp; - char c; - int i, rc=1; - - if ((fp = HDfopen(filename, "r")) == (FILE *)NULL) { - error_msg("cannot open options file %s\n", filename); - HDexit(EXIT_FAILURE); - } - - /* cycle until end of file reached */ - while( 1 ) - { - rc=fscanf(fp, "%s", stype); - if (rc==-1) - break; - - /*------------------------------------------------------------------------- - * filter - *------------------------------------------------------------------------- - */ - if (HDstrcmp(stype,"-f") == 0) { - - /* find begining of info */ - i=0; c='0'; - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - if (HDfeof(fp)) break; - } - c='0'; - /* go until end */ - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - comp_info[i]=c; - i++; - if (HDfeof(fp)) break; - if (c==10 /*eol*/) break; - } - comp_info[i-1]='\0'; /*cut the last " */ - - if (h5repack_addfilter(comp_info,options)==-1){ - error_msg("could not add compression option\n"); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * layout - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(stype,"-l") == 0) { - - /* find begining of info */ - i=0; c='0'; - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - if (HDfeof(fp)) break; - } - c='0'; - /* go until end */ - while( c!=' ' ) - { - fscanf(fp, "%c", &c); - comp_info[i]=c; - i++; - if (HDfeof(fp)) break; - if (c==10 /*eol*/) break; - } - comp_info[i-1]='\0'; /*cut the last " */ - - if (h5repack_addlayout(comp_info,options)==-1){ - error_msg("could not add chunck option\n"); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * not valid - *------------------------------------------------------------------------- - */ - else { - error_msg("bad file format for %s", filename); - HDexit(EXIT_FAILURE); - } - } - - HDfclose(fp); - return; +int main(int argc, const char **argv) { + + pack_opt_t options; /*the global options */ + int ret = -1; + + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + + /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ + if (h5tools_getenv_update_hyperslab_bufsize() < 0) { + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + + /* initialize options */ + h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0); + + if (parse_command_line(argc, argv, &options) < 0) + goto done; + + /* get file names if they were not yet got */ + if (has_i_o == 0) { + + if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { + infile = argv[opt_ind]; + outfile = argv[opt_ind + 1]; + + if ( HDstrcmp( infile, outfile ) == 0) { + error_msg("file names cannot be the same\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + else { + error_msg("file names missing\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + + /* pack it */ + h5tools_setstatus(h5repack(infile, outfile, &options)); + +done: + /* free tables */ + h5repack_end(&options); + + leave(h5tools_getstatus()); } + diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index bcddbb9..b54e887 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -1,4 +1,4 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -27,21 +27,19 @@ *------------------------------------------------------------------------- */ -void init_packobject(pack_info_t *obj) -{ - int j, k; - - HDstrcpy(obj->path,"\0"); - for ( j=0; jfilter[j].filtn = -1; - for ( k=0; kfilter[j].cd_values[k] = 0; - } - obj->chunk.rank = -1; - obj->refobj_id = -1; - obj->layout = H5D_LAYOUT_ERROR; - obj->nfilters = 0; +void init_packobject(pack_info_t *obj) { + int j, k; + + HDstrcpy(obj->path, "\0"); + for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) { + obj->filter[j].filtn = -1; + for (k = 0; k < CD_VALUES; k++) + obj->filter[j].cd_values[k] = 0; + } + obj->chunk.rank = -1; + obj->refobj_id = -1; + obj->layout = H5D_LAYOUT_ERROR; + obj->nfilters = 0; } /*------------------------------------------------------------------------- @@ -54,19 +52,16 @@ void init_packobject(pack_info_t *obj) *------------------------------------------------------------------------- */ -static void aux_tblinsert_filter(pack_opttbl_t *table, - unsigned int I, - filter_info_t filt) -{ - if (table->objs[ I ].nfiltersobjs[ I ].filter[ table->objs[ I ].nfilters++ ] = filt; - } - else - { - error_msg("cannot insert the filter in this object.\ +static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, + filter_info_t filt) { + if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) { + table->objs[I].filter[table->objs[I].nfilters++] = filt; + } + else { + error_msg( + "cannot insert the filter in this object.\ Maximum capacity exceeded\n"); - } + } } /*------------------------------------------------------------------------- @@ -79,33 +74,28 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, *------------------------------------------------------------------------- */ -static void aux_tblinsert_layout(pack_opttbl_t *table, - unsigned int I, - pack_info_t *pack) -{ - int k; - - table->objs[I].layout = pack->layout; - if (H5D_CHUNKED==pack->layout) - { - /* -2 means the NONE option, remove chunking - and set the layout to contiguous */ - if (pack->chunk.rank==-2) - { - table->objs[I].layout = H5D_CONTIGUOUS; - table->objs[I].chunk.rank = -2; - } - /* otherwise set the chunking type */ - else - { - table->objs[I].chunk.rank = pack->chunk.rank; - for (k = 0; k < pack->chunk.rank; k++) - table->objs[I].chunk.chunk_lengths[k] = pack->chunk.chunk_lengths[k]; - } - } +static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, + pack_info_t *pack) { + int k; + + table->objs[I].layout = pack->layout; + if (H5D_CHUNKED == pack->layout) { + /* -2 means the NONE option, remove chunking + and set the layout to contiguous */ + if (pack->chunk.rank == -2) { + table->objs[I].layout = H5D_CONTIGUOUS; + table->objs[I].chunk.rank = -2; + } + /* otherwise set the chunking type */ + else { + table->objs[I].chunk.rank = pack->chunk.rank; + for (k = 0; k < pack->chunk.rank; k++) + table->objs[I].chunk.chunk_lengths[k] = + pack->chunk.chunk_lengths[k]; + } + } } - /*------------------------------------------------------------------------- * Function: aux_inctable * @@ -116,21 +106,20 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, *------------------------------------------------------------------------- */ -static int aux_inctable(pack_opttbl_t *table, int n_objs ) -{ - unsigned int i; - - table->size += n_objs; - table->objs = (pack_info_t*)HDrealloc(table->objs, table->size * sizeof(pack_info_t)); - if (table->objs==NULL) { - error_msg("not enough memory for options table\n"); - return -1; - } - for (i = table->nelems; i < table->size; i++) - { - init_packobject(&table->objs[i]); - } - return 0; +static int aux_inctable(pack_opttbl_t *table, int n_objs) { + unsigned int i; + + table->size += n_objs; + table->objs = + (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); + if (table->objs == NULL) { + error_msg("not enough memory for options table\n"); + return -1; + } + for (i = table->nelems; i < table->size; i++) { + init_packobject(&table->objs[i]); + } + return 0; } @@ -143,31 +132,29 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs ) * *------------------------------------------------------------------------- */ -int options_table_init( pack_opttbl_t **tbl ) -{ - unsigned int i; - pack_opttbl_t *table; - - if(NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) - { - error_msg("not enough memory for options table\n"); - return -1; - } - - table->size = 30; - table->nelems = 0; - if(NULL == (table->objs = (pack_info_t*)HDmalloc(table->size * sizeof(pack_info_t)))) - { - error_msg("not enough memory for options table\n"); - HDfree(table); - return -1; - } - - for(i = 0; i < table->size; i++) - init_packobject(&table->objs[i]); - - *tbl = table; - return 0; +int options_table_init(pack_opttbl_t **tbl) { + unsigned int i; + pack_opttbl_t *table; + + if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { + error_msg("not enough memory for options table\n"); + return -1; + } + + table->size = 30; + table->nelems = 0; + if (NULL == (table->objs = + (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { + error_msg("not enough memory for options table\n"); + HDfree(table); + return -1; + } + + for (i = 0; i < table->size; i++) + init_packobject(&table->objs[i]); + + *tbl = table; + return 0; } @@ -181,11 +168,10 @@ int options_table_init( pack_opttbl_t **tbl ) *------------------------------------------------------------------------- */ -int options_table_free( pack_opttbl_t *table ) -{ - HDfree(table->objs); - HDfree(table); - return 0; +int options_table_free(pack_opttbl_t *table) { + HDfree(table->objs); + HDfree(table); + return 0; } /*------------------------------------------------------------------------- @@ -198,95 +184,81 @@ int options_table_free( pack_opttbl_t *table ) *------------------------------------------------------------------------- */ - -int options_add_layout( obj_list_t *obj_list, - int n_objs, - pack_info_t *pack, - pack_opttbl_t *table ) -{ - unsigned int i, I; - int j, added=0, found=0; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems+n_objs >= table->size) - { - if (aux_inctable(table,n_objs)<0) - return -1; - } - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems>0) - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - /* linear table search */ - for (i = 0; i < table->nelems; i++) - { - /*already on the table */ - if (HDstrcmp(obj_list[j].obj,table->objs[i].path)==0) - { - /* already chunk info inserted for this one; exit */ - if (table->objs[i].chunk.rank>0) - { - error_msg("chunk information already inserted for <%s>\n",obj_list[j].obj); - HDexit(EXIT_FAILURE); - } - /* insert the layout info */ - else - { - aux_tblinsert_layout(table,i,pack); - found=1; - break; - } - } /* if */ - } /* i */ - - if (found==0) - { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_layout(table,I,pack); - } - /* cases where we have an already inserted name but there is a new name also - example: - -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 - dset1 is already inserted, but dset2 must also be - */ - else if (found==1 && HDstrcmp(obj_list[j].obj,table->objs[i].path)!=0) - { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_layout(table,I,pack); - } - } /* j */ - } - - /* first time insertion */ - else - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_layout(table,I,pack); - - } - } - - table->nelems+= added; - - return 0; +int options_add_layout(obj_list_t *obj_list, int n_objs, pack_info_t *pack, + pack_opttbl_t *table) { + unsigned int i, I; + int j, added = 0, found = 0; + + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems + n_objs >= table->size) { + if (aux_inctable(table, n_objs) < 0) + return -1; + } + + /* search if this object is already in the table; "path" is the key */ + if (table->nelems > 0) { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + /* linear table search */ + for (i = 0; i < table->nelems; i++) { + /*already on the table */ + if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { + /* already chunk info inserted for this one; exit */ + if (table->objs[i].chunk.rank > 0) { + error_msg( + "chunk information already inserted for <%s>\n", + obj_list[j].obj); + HDexit(EXIT_FAILURE); + } + /* insert the layout info */ + else { + aux_tblinsert_layout(table, i, pack); + found = 1; + break; + } + } /* if */ + } /* i */ + + if (found == 0) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_layout(table, I, pack); + } + /* cases where we have an already inserted name but there is a new name also + example: + -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 + dset1 is already inserted, but dset2 must also be + */ + else if (found == 1 + && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_layout(table, I, pack); + } + } /* j */ + } + + /* first time insertion */ + else { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_layout(table, I, pack); + + } + } + + table->nelems += added; + + return 0; } - - /*------------------------------------------------------------------------- * Function: options_add_filter * @@ -297,81 +269,70 @@ int options_add_layout( obj_list_t *obj_list, *------------------------------------------------------------------------- */ -int options_add_filter(obj_list_t *obj_list, - int n_objs, - filter_info_t filt, - pack_opttbl_t *table ) -{ - - unsigned int i, I; - int j, added=0, found=0; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems+n_objs >= table->size) - { - if (aux_inctable(table,n_objs)<0) - return -1; - } - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems>0) - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - /* linear table search */ - for (i = 0; i < table->nelems; i++) - { - /*already on the table */ - if (HDstrcmp(obj_list[j].obj,table->objs[i].path)==0) - { - /* insert */ - aux_tblinsert_filter(table,i,filt); - found=1; - break; - } /* if */ - } /* i */ - - if (found==0) - { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_filter(table,I,filt); - } - /* cases where we have an already inserted name but there is a new name also - example: - -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 - dset1 is already inserted, but dset2 must also be - */ - else if (found==1 && HDstrcmp(obj_list[j].obj,table->objs[i].path)!=0) - { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_filter(table,I,filt); - } - } /* j */ - } - - /* first time insertion */ - else - { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) - { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path,obj_list[j].obj); - aux_tblinsert_filter(table,I,filt); - } - } - - table->nelems+= added; - - return 0; +int options_add_filter(obj_list_t *obj_list, int n_objs, filter_info_t filt, + pack_opttbl_t *table) { + + unsigned int i, I; + int j, added = 0, found = 0; + + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems + n_objs >= table->size) { + if (aux_inctable(table, n_objs) < 0) + return -1; + } + + /* search if this object is already in the table; "path" is the key */ + if (table->nelems > 0) { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + /* linear table search */ + for (i = 0; i < table->nelems; i++) { + /*already on the table */ + if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { + /* insert */ + aux_tblinsert_filter(table, i, filt); + found = 1; + break; + } /* if */ + } /* i */ + + if (found == 0) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_filter(table, I, filt); + } + /* cases where we have an already inserted name but there is a new name also + example: + -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 + dset1 is already inserted, but dset2 must also be + */ + else if (found == 1 + && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_filter(table, I, filt); + } + } /* j */ + } + + /* first time insertion */ + else { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_filter(table, I, filt); + } + } + + table->nelems += added; + + return 0; } /*------------------------------------------------------------------------- @@ -384,34 +345,25 @@ int options_add_filter(obj_list_t *obj_list, *------------------------------------------------------------------------- */ -pack_info_t* options_get_object( const char *path, - pack_opttbl_t *table ) -{ - unsigned int i; - char tbl_path[MAX_NC_NAME+1]; /* +1 for start with "/" case */ - - - for ( i = 0; i < table->nelems; i++) - { - /* make full path (start with "/") to compare correctly */ - if (HDstrncmp(table->objs[i].path, "/", 1)) - { - HDstrcpy(tbl_path, "/"); - HDstrcat(tbl_path, table->objs[i].path); - } - else - HDstrcpy(tbl_path, table->objs[i].path); - - /* found it */ - if (HDstrcmp(tbl_path, path)==0) - { - return (&table->objs[i]); - } - } - - return NULL; +pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) { + unsigned int i; + char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */ + + for (i = 0; i < table->nelems; i++) { + /* make full path (start with "/") to compare correctly */ + if (HDstrncmp(table->objs[i].path, "/", 1)) { + HDstrcpy(tbl_path, "/"); + HDstrcat(tbl_path, table->objs[i].path); + } + else + HDstrcpy(tbl_path, table->objs[i].path); + + /* found it */ + if (HDstrcmp(tbl_path, path) == 0) { + return (&table->objs[i]); + } + } + + return NULL; } - - - diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 9f798e9..8a297a7 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -31,6 +31,7 @@ * FLET, to apply the HDF5 checksum filter * NBIT, to apply the HDF5 NBIT filter (NBIT compression) * SOFF, to apply the HDF5 scale+offset filter (compression) + * UD, to apply a User Defined filter k, m, n1[,…,nm] * NONE, to remove the filter * * Examples: @@ -51,402 +52,468 @@ obj_list_t* parse_filter(const char *str, pack_opt_t *options, int *is_glb) { - unsigned i, u; - char c; - size_t len=HDstrlen(str); - int j, m, n, k, l, end_obj=-1, no_param=0; - char sobj[MAX_NC_NAME]; - char scomp[10]; - char stype[5]; - char smask[3]; - obj_list_t* obj_list=NULL; - unsigned pixels_per_block; - - - /* initialize compression info */ - HDmemset(filt,0,sizeof(filter_info_t)); - *is_glb = 0; - - /* check for the end of object list and number of objects */ - for ( i = 0, n = 0; i < len; i++) - { - c = str[i]; - if ( c==':' ) - { - end_obj=i; - } - if ( c==',' ) - { - n++; - } - } - - if (end_obj==-1) /* missing : */ - { - /* apply to all objects */ - options->all_filter=1; - *is_glb = 1; - } - - n++; - obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); - if (obj_list==NULL) - { - error_msg("could not allocate object list\n"); - return NULL; - } - *n_objs=n; - - /* get object list */ - for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) - { - c = str[j]; - sobj[k] = c; - if ( c==',' || j==end_obj-1) - { - if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; - HDstrcpy(obj_list[n].obj,sobj); - HDmemset(sobj,0,sizeof(sobj)); - n++; - k=-1; - } - } - /* nothing after : */ - if (end_obj+1==(int)len) - { - if (obj_list) HDfree(obj_list); - error_msg("input Error: Invalid compression type in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - - - /* get filter additional parameters */ - m=0; - for ( i=end_obj+1, k=0, j=0; i - * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN' - * example SZIP=8,NN - *------------------------------------------------------------------------- - */ - if (HDstrcmp(scomp,"SZIP")==0) - { - l=-1; /* mask index check */ - for ( m=0,u=i+1; u\n",str); - HDexit(EXIT_FAILURE); - } - if (l==-1) - stype[m]=c; - else - { - smask[l]=c; - l++; - if (l==2) - { - smask[l]='\0'; - i=len-1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - if (HDstrcmp(smask,"NN")==0) - filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK; - else if (HDstrcmp(smask,"EC")==0) - filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK; - else - { - error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); - } - - - } - } - - } /* u */ - } /*if */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - * scaleoffset has the format SOFF= - * scale_type can be - * integer datatype, H5Z_SO_INT (IN) - * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS) - * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented - * for integer datatypes, scale_factor denotes Minimum Bits - * for float datatypes, scale_factor denotes decimal scale factor - * examples - * SOFF=31,IN - * SOFF=3,DF - *------------------------------------------------------------------------- - */ - - else if (HDstrcmp(scomp,"SOFF")==0) - { - l=-1; /* mask index check */ - for ( m=0,u=i+1; u\n",str); - HDexit(EXIT_FAILURE); - } - if (l==-1) - stype[m]=c; - else - { - smask[l]=c; - l++; - if (l==2) - { - smask[l]='\0'; - i=len-1; /* end */ - (*n_objs)--; /* we counted an extra ',' */ - if (HDstrcmp(smask,"IN")==0) - filt->cd_values[j++]=H5Z_SO_INT; - else if (HDstrcmp(smask,"DS")==H5Z_SO_FLOAT_DSCALE) - filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE; - else - { - error_msg("scale type must be 'IN' or 'DS' \n"); - HDexit(EXIT_FAILURE); - } - - } - } - - } /* u */ - } /*if */ - - - /*------------------------------------------------------------------------- - * all other filters - *------------------------------------------------------------------------- - */ - - else - { - /* here we could have 1 or 2 digits */ - for ( m=0,u=i+1; u\n",str); - HDexit(EXIT_FAILURE); - } - stype[m]=c; - } /* u */ - - stype[m]='\0'; - } /*if */ - - - - filt->cd_values[j++]=atoi(stype); - i+=m; /* jump */ - } - else if (i==len-1) - { /*no more parameters */ - scomp[k+1]='\0'; - no_param=1; - } - - /*------------------------------------------------------------------------- - * translate from string to filter symbol - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * H5Z_FILTER_NONE - *------------------------------------------------------------------------- - */ - if (HDstrcmp(scomp,"NONE")==0) - { - filt->filtn=H5Z_FILTER_NONE; - filt->cd_nelmts = 0; - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"GZIP")==0) - { - filt->filtn=H5Z_FILTER_DEFLATE; - filt->cd_nelmts = 1; - if (no_param) - { /*no more parameters, GZIP must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SZIP")==0) - { - filt->filtn=H5Z_FILTER_SZIP; - filt->cd_nelmts = 2; - if (no_param) - { /*no more parameters, SZIP must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SHUFFLE - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SHUF")==0) - { - filt->filtn=H5Z_FILTER_SHUFFLE; - filt->cd_nelmts = 0; - if (m>0) - { /*shuffle does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in SHUF <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_FLETCHER32 - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"FLET")==0) - { - filt->filtn=H5Z_FILTER_FLETCHER32; - filt->cd_nelmts = 0; - if (m>0) - { /*shuffle does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in FLET <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_NBIT - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"NBIT")==0) - { - filt->filtn=H5Z_FILTER_NBIT; - filt->cd_nelmts = 0; - if (m>0) - { /*nbit does not have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("extra parameter in NBIT <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - /*------------------------------------------------------------------------- - * H5Z_FILTER_SCALEOFFSET - *------------------------------------------------------------------------- - */ - else if (HDstrcmp(scomp,"SOFF")==0) - { - filt->filtn=H5Z_FILTER_SCALEOFFSET; - filt->cd_nelmts = 2; - if (no_param) - { /*no more parameters, SOFF must have parameter */ - if (obj_list) HDfree(obj_list); - error_msg("missing compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - else { - if (obj_list) HDfree(obj_list); - error_msg("invalid filter type in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - } - } /*i*/ - - /*------------------------------------------------------------------------- - * check valid parameters - *------------------------------------------------------------------------- - */ - - switch (filt->filtn) - { - - /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE - *------------------------------------------------------------------------- - */ - - case H5Z_FILTER_DEFLATE: - if (filt->cd_values[0]>9 ) - { - if (obj_list) HDfree(obj_list); - error_msg("invalid compression parameter in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - break; - - /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP - *------------------------------------------------------------------------- - */ - - case H5Z_FILTER_SZIP: - pixels_per_block=filt->cd_values[0]; - if ((pixels_per_block%2)==1) - { - if (obj_list) HDfree(obj_list); - error_msg("pixels_per_block is not even in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) - { - if (obj_list) HDfree(obj_list); - error_msg("pixels_per_block is too large in <%s>\n",str); - HDexit(EXIT_FAILURE); - } - if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) ) - { - if (obj_list) HDfree(obj_list); - error_msg("szip mask must be 'NN' or 'EC' \n"); - HDexit(EXIT_FAILURE); - } - break; - default: - break; - - - }; - - return obj_list; + unsigned i, u; + char c; + size_t len=HDstrlen(str); + int j, m, n, k, l, p, r, q, end_obj=-1, no_param=0; + char sobj[MAX_NC_NAME]; + char scomp[10]; + char stype[5]; + char smask[3]; + obj_list_t* obj_list=NULL; + unsigned pixels_per_block; + + + /* initialize compression info */ + HDmemset(filt,0,sizeof(filter_info_t)); + *is_glb = 0; + + /* check for the end of object list and number of objects */ + for ( i = 0, n = 0; i < len; i++) + { + c = str[i]; + if ( c==':' ) + { + end_obj=i; + } + if ( c==',' ) + { + n++; + } + } + + if (end_obj==-1) /* missing : */ + { + /* apply to all objects */ + options->all_filter=1; + *is_glb = 1; + } + + n++; + obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); + if (obj_list==NULL) + { + error_msg("could not allocate object list\n"); + return NULL; + } + *n_objs=n; + + /* get object list */ + for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) + { + c = str[j]; + sobj[k] = c; + if ( c==',' || j==end_obj-1) + { + if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; + HDstrcpy(obj_list[n].obj,sobj); + HDmemset(sobj,0,sizeof(sobj)); + n++; + k=-1; + } + } + /* nothing after : */ + if (end_obj+1==(int)len) + { + if (obj_list) HDfree(obj_list); + error_msg("input Error: Invalid compression type in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + + + /* get filter additional parameters */ + m=0; + for ( i=end_obj+1, k=0, j=0; i + * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN' + * example SZIP=8,NN + *------------------------------------------------------------------------- + */ + if (HDstrcmp(scomp,"SZIP")==0) + { + l=-1; /* mask index check */ + for ( m=0,u=i+1; u\n",str); + HDexit(EXIT_FAILURE); + } + if (l==-1) + stype[m]=c; + else + { + smask[l]=c; + l++; + if (l==2) + { + smask[l]='\0'; + i=len-1; /* end */ + (*n_objs)--; /* we counted an extra ',' */ + if (HDstrcmp(smask,"NN")==0) + filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK; + else if (HDstrcmp(smask,"EC")==0) + filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK; + else + { + error_msg("szip mask must be 'NN' or 'EC' \n"); + HDexit(EXIT_FAILURE); + } + + + } + } + + } /* u */ + } /*if */ + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + * scaleoffset has the format SOFF= + * scale_type can be + * integer datatype, H5Z_SO_INT (IN) + * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS) + * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented + * for integer datatypes, scale_factor denotes Minimum Bits + * for float datatypes, scale_factor denotes decimal scale factor + * examples + * SOFF=31,IN + * SOFF=3,DF + *------------------------------------------------------------------------- + */ + + else if (HDstrcmp(scomp,"SOFF")==0) + { + l=-1; /* mask index check */ + for ( m=0,u=i+1; u\n",str); + HDexit(EXIT_FAILURE); + } + if (l==-1) + stype[m]=c; + else + { + smask[l]=c; + l++; + if (l==2) + { + smask[l]='\0'; + i=len-1; /* end */ + (*n_objs)--; /* we counted an extra ',' */ + if (HDstrcmp(smask,"IN")==0) + filt->cd_values[j++]=H5Z_SO_INT; + else if (HDstrcmp(smask,"DS")==H5Z_SO_FLOAT_DSCALE) + filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE; + else + { + error_msg("scale type must be 'IN' or 'DS' \n"); + HDexit(EXIT_FAILURE); + } + + } + } + + } /* u */ + } /*if */ + /*------------------------------------------------------------------------- + * User Defined + * has the format UD= + * BZIP2 example + * UD=307,1,9 + *------------------------------------------------------------------------- + */ + + else if (HDstrcmp(scomp,"UD")==0) + { + l=-1; /* filter number index check */ + p=-1; /* CD_VAL count check */ + r=-1; /* CD_VAL check */ + for ( m=0,q=0,u=i+1; ufiltn=atoi(stype); + l=0; + } + else if (p==-1) + { + filt->cd_nelmts=atoi(stype); + p=0; + } + else + r=0; + q=0; + u++; /* skip ',' */ + } + c = str[u]; + if (!isdigit(c) && l==-1) + { + if (obj_list) HDfree(obj_list); + error_msg("filter number parameter is not a digit in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + stype[q]=c; + if (l==0 && p==0) + { + if (r==0) + filt->cd_values[j++]=atoi(stype); + } + + } /* u */ + + stype[q]='\0'; + } /*if */ + + + /*------------------------------------------------------------------------- + * all other filters + *------------------------------------------------------------------------- + */ + + else + { + /* here we could have 1 or 2 digits */ + for ( m=0,u=i+1; u\n",str); + HDexit(EXIT_FAILURE); + } + stype[m]=c; + } /* u */ + + stype[m]='\0'; + } /*if */ + + + + filt->cd_values[j++]=atoi(stype); + i+=m; /* jump */ + } + else if (i==len-1) + { /*no more parameters */ + scomp[k+1]='\0'; + no_param=1; + } + + /*------------------------------------------------------------------------- + * translate from string to filter symbol + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * H5Z_FILTER_NONE + *------------------------------------------------------------------------- + */ + if (HDstrcmp(scomp,"NONE")==0) + { + filt->filtn=H5Z_FILTER_NONE; + filt->cd_nelmts = 0; + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"GZIP")==0) + { + filt->filtn=H5Z_FILTER_DEFLATE; + filt->cd_nelmts = 1; + if (no_param) + { /*no more parameters, GZIP must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SZIP")==0) + { + filt->filtn=H5Z_FILTER_SZIP; + filt->cd_nelmts = 2; + if (no_param) + { /*no more parameters, SZIP must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SHUFFLE + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SHUF")==0) + { + filt->filtn=H5Z_FILTER_SHUFFLE; + filt->cd_nelmts = 0; + if (m>0) + { /*shuffle does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in SHUF <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_FLETCHER32 + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"FLET")==0) + { + filt->filtn=H5Z_FILTER_FLETCHER32; + filt->cd_nelmts = 0; + if (m>0) + { /*shuffle does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in FLET <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_NBIT + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"NBIT")==0) + { + filt->filtn=H5Z_FILTER_NBIT; + filt->cd_nelmts = 0; + if (m>0) + { /*nbit does not have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("extra parameter in NBIT <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * H5Z_FILTER_SCALEOFFSET + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"SOFF")==0) + { + filt->filtn=H5Z_FILTER_SCALEOFFSET; + filt->cd_nelmts = 2; + if (no_param) + { /*no more parameters, SOFF must have parameter */ + if (obj_list) HDfree(obj_list); + error_msg("missing compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + /*------------------------------------------------------------------------- + * User Defined Filter + *------------------------------------------------------------------------- + */ + else if (HDstrcmp(scomp,"UD")==0) + { + if (filt->cd_nelmts != j) + { /* parameters does not match count */ + if (obj_list) HDfree(obj_list); + error_msg("incorrect number of compression parameters in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + else { + if (obj_list) HDfree(obj_list); + error_msg("invalid filter type in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + } + } /*i*/ + + /*------------------------------------------------------------------------- + * check valid parameters + *------------------------------------------------------------------------- + */ + + switch (filt->filtn) + { + + /*------------------------------------------------------------------------- + * H5Z_FILTER_DEFLATE + *------------------------------------------------------------------------- + */ + + case H5Z_FILTER_DEFLATE: + if (filt->cd_values[0]>9 ) + { + if (obj_list) HDfree(obj_list); + error_msg("invalid compression parameter in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + break; + + /*------------------------------------------------------------------------- + * H5Z_FILTER_SZIP + *------------------------------------------------------------------------- + */ + + case H5Z_FILTER_SZIP: + pixels_per_block=filt->cd_values[0]; + if ((pixels_per_block%2)==1) + { + if (obj_list) HDfree(obj_list); + error_msg("pixels_per_block is not even in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) + { + if (obj_list) HDfree(obj_list); + error_msg("pixels_per_block is too large in <%s>\n",str); + HDexit(EXIT_FAILURE); + } + if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) ) + { + if (obj_list) HDfree(obj_list); + error_msg("szip mask must be 'NN' or 'EC' \n"); + HDexit(EXIT_FAILURE); + } + break; + default: + break; + + + }; + + return obj_list; } diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in new file mode 100644 index 0000000..e8ba83e --- /dev/null +++ b/tools/h5repack/h5repack_plugin.sh.in @@ -0,0 +1,238 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic document set and is +# linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access +# to either file, you may request a copy from help@hdfgroup.org. +# +srcdir=@srcdir@ +TOP_BUILDDIR=@top_builddir@ + +# Determine backward compatibility options enabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +H5REPACK=h5repack # The tool name +H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary + +H5DUMP=../h5dump/h5dump # The h5dump tool name +H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary + +nerrors=0 +verbose=yes +exit_code=$EXIT_SUCCESS + +TEST_NAME=ud_plugin +FROM_DIR=`pwd`/.libs +PLUGIN_LIB="$FROM_DIR/libdynlibadd.*" +PLUGIN_LIBDIR=testdir3 +RM="rm -rf" + +GREP='grep' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# source dirs +SRC_TOOLS="$srcdir/.." + +# testfiles source dirs for tools +SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" + +TESTDIR=testfiles +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5 +$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl +$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst +" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES" + +# Main Body +# Create test directories if not exists yet. +test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to create test directory($PLUGIN_LIBDIR)" + exit $EXIT_FAILURE +fi + +# copy plugin library for test +$CP $PLUGIN_LIB $PLUGIN_LIBDIR +if [ $? != 0 ]; then + echo "Failed to copy plugin library ($PLUGIN_LIB) for test." + exit $EXIT_FAILURE +fi + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_LIBDIR}" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $TESTDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +# Print a $* message left justified in a field of 70 characters +# +MESSAGE() { + SPACES=" " + echo "$* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Verifying". +# +VERIFY() { + MESSAGE "Verifying $*" +} + +# This is different from $srcdir/../../bin/output_filter.sh +STDOUT_FILTER() { + result_file=$1 + tmp_file=/tmp/h5test_tmp_$$ + # Filter name of files. + cp $result_file $tmp_file + sed -e '/^Opening file/d' -e '/^Making file/d' \ + < $tmp_file > $result_file + # cleanup + rm -f $tmp_file +} + +# This runs h5repack comparing output with h5dump output +# from -pH option +# +TOOLTEST_DUMP() +{ + echo $@ + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + expect1="$TESTDIR/$1.$2.tst" + actual1="$TESTDIR/$1.$2.out" + actual1_err="$TESTDIR/$1.$2.err" + expect2="$TESTDIR/$2-$1.ddl" + actual2="$TESTDIR/$2-$1.out" + actual2_err="$TESTDIR/$2-$1.err" + + shift + shift + + # Run test. + TESTING $H5REPACK $@ + ( + $ENVCMD $H5REPACK_BIN "$@" $infile $outfile + ) >$actual1 2>$actual1_err + RET=$? + STDOUT_FILTER $actual1 + cat $actual1_err >> $actual1 + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + if cmp -s $expect1 $actual1; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.tst) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect1 $actual1 |sed 's/^/ /' + fi + VERIFY h5dump output -pH $outfile + ( + $ENVCMD $H5DUMP_BIN -pH $outfile + ) >$actual2 2>$actual2_err + RET=$? + cat $actual2_err >> $actual2 + + if cmp -s $expect2 $actual2; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && diff -c $expect2 $actual2 |sed 's/^/ /' + fi + + fi + + + rm -f $actual1 $actual1_err $actual2 $actual2_err + rm -f $outfile +} + +############################################################################## +### T H E T E S T S +############################################################################## +# prepare for test +COPY_TESTFILES_TO_TESTDIR + +# Run the test +arg="h5repack_layout.h5 -v -f UD=257,1,9" +#TOOLTEST_DUMP plugin_test $arg + +# print results +if test $nerrors -ne 0 ; then + echo "$nerrors errors encountered" + exit_code=$EXIT_FAILURE +else + echo "All Plugin API tests passed." + exit_code=$EXIT_SUCCESS +fi + +# Clean up temporary files/directories and leave +$RM $PLUGIN_LIBDIR +exit $exit_code diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index a57295b..42799f9 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -601,6 +601,9 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) switch (filtn) { + case H5Z_FILTER_NONE: + break; + case H5Z_FILTER_SHUFFLE: /* 1 private client value is returned by DCPL */ @@ -677,7 +680,17 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) break; default: - /* filter has no local values */ + if ( cd_nelmts != filter[i].cd_nelmts) + return 0; + + for( j = 0; j < cd_nelmts; j++) + { + if (cd_values[j] != filter[i].cd_values[j]) + { + return 0; + } + + } break; } /* switch */ diff --git a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl new file mode 100644 index 0000000..d380201 --- /dev/null +++ b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl @@ -0,0 +1,130 @@ +HDF5 "./testfiles/out-deflate_limit.h5repack_layout.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset3" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset4" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_chunk" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } + STORAGE_LAYOUT { + CHUNKED ( 20, 10 ) + SIZE 1283 (2.494:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_compact" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_contiguous" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 1150 (2.783:1 COMPRESSION) + } + FILTERS { + COMPRESSION DEFLATE { LEVEL 1 } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } +} +} diff --git a/tools/h5repack/testfiles/h5repack-help.txt b/tools/h5repack/testfiles/h5repack-help.txt new file mode 100644 index 0000000..6de1eb4 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack-help.txt @@ -0,0 +1,122 @@ +usage: h5repack [OPTIONS] file1 file2 + file1 Input HDF5 File + file2 Output HDF5 File + OPTIONS + -h, --help Print a usage message and exit + -v, --verbose Verbose mode, print object information + -V, --version Print version number and exit + -n, --native Use a native HDF5 type when repacking + -L, --latest Use latest version of file format + -c L1, --compact=L1 Maximum number of links in header messages + -d L2, --indexed=L2 Minimum number of links in the indexed format + -s S[:F], --ssize=S[:F] Shared object header message minimum size + -m M, --minimum=M Do not apply the filter to datasets smaller than M + -e E, --file=E Name of file E with the -f and -l options + -u U, --ublock=U Name of file U with user block data to be added + -b B, --block=B Size of user block to be added + -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size + -t T, --threshold=T Threshold value for H5Pset_alignment + -a A, --alignment=A Alignment value for H5Pset_alignment + -f FILT, --filter=FILT Filter type + -l LAYT, --layout=LAYT Layout type + -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy + -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold + + M - is an integer greater than 1, size of dataset in bytes (default is 0) + E - is a filename. + S - is an integer + U - is a filename. + T - is an integer + A - is an integer greater than zero + B - is the user block size, any value that is 512 or greater and is + a power of 2 (1024 default) + F - is the shared object header message type, any of . If F is not specified, S applies to all messages + + FS_STRGY is the file space management strategy to use for the output file. + It is a string as listed below: + ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver + for file space allocation + ALL - Use non-persistent free-space managers, aggregators and virtual file driver + for file space allocation + AGGR_VFD - Use aggregators and virtual file driver for file space allocation + VFD - Use virtual file driver for file space allocation + + FS_THRD is the free-space section threshold to use for the output file. + It is the minimum size (in bytes) of free-space sections to be tracked + by the the library's free-space managers. + + FILT - is a string with the format: + + := + + is a comma separated list of object names, meaning apply + compression only to those objects. If no names are specified, the filter + is applied to all objects + can be: + GZIP, to apply the HDF5 GZIP filter (GZIP compression) + SZIP, to apply the HDF5 SZIP filter (SZIP compression) + SHUF, to apply the HDF5 shuffle filter + FLET, to apply the HDF5 checksum filter + NBIT, to apply the HDF5 NBIT filter (NBIT compression) + SOFF, to apply the HDF5 Scale/Offset filter + UD, to apply a user defined filter + NONE, to remove all filters + is optional filter parameter information + GZIP= from 1-9 + SZIP= pixels per block is a even number in + 2-32 and coding method is either EC or NN + SHUF (no parameter) + FLET (no parameter) + NBIT (no parameter) + SOFF= scale_factor is an integer and scale_type + is either IN or DS + UD= + required values for filter_number,cd_value_count,value_1 + optional values for value_2 to value_N + NONE (no parameter) + + LAYT - is a string with the format: + + := + + is a comma separated list of object names, meaning that + layout information is supplied for those objects. If no names are + specified, the layout type is applied to all objects + can be: + CHUNK, to apply chunking layout + COMPA, to apply compact layout + CONTI, to apply contiguous layout + is optional layout information + CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension + COMPA (no parameter) + CONTI (no parameter) + +Examples of use: + +1) h5repack -v -f GZIP=1 file1 file2 + + GZIP compression with level 1 to all objects + +2) h5repack -v -f A:SZIP=8,NN file1 file2 + + SZIP compression with 8 pixels per block and NN coding method to object A + +3) h5repack -v -l A,B:CHUNK=20x10 -f C,D,F:NONE file1 file2 + + Chunked layout, with a layout size of 20x10, to objects A and B + and remove filters to objects C, D, F + +4) h5repack -L -c 10 -s 20:dtype file1 file2 + + Using latest file format with maximum compact group size of 10 and + and minimum shared datatype size of 20 + +5) h5repack -f SHUF -f GZIP=1 file1 file2 + + Add both filters SHUF and GZIP in this order to all datasets + +6) h5repack -f UD=307,1,9 file1 file2 + + Add bzip2 filter to all datasets + diff --git a/tools/h5repack/testfiles/h5repack_filters.h5.tst b/tools/h5repack/testfiles/h5repack_filters.h5.tst new file mode 100644 index 0000000..36e65b9 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_filters.h5.tst @@ -0,0 +1,13 @@ +Objects to modify layout are... +Objects to apply filter are... + with GZIP filter + ...Found +----------------------------------------- + Type Filter (Compression) Name +----------------------------------------- + group / + dset /dset_all + dset GZIP (0.995:1) /dset_deflate + dset /dset_fletcher32 + dset /dset_nbit + dset /dset_shuffle diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl new file mode 100644 index 0000000..a7ba967 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl @@ -0,0 +1,158 @@ +HDF5 "testfiles/out-plugin_test.h5repack_layout.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset2" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset3" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset4" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_chunk" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } + STORAGE_LAYOUT { + CHUNKED ( 20, 10 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_compact" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } + DATASET "dset_contiguous" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } + STORAGE_LAYOUT { + CHUNKED ( 40, 20 ) + SIZE 3200 (1.000:1 COMPRESSION) + } + FILTERS { + USER_DEFINED_FILTER { + FILTER_ID 257 + COMMENT dynlib1 + PARAMS { 9 } + } + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } + } +} +} diff --git a/tools/h5repack/testfiles/h5repack_layout.h5.ddl b/tools/h5repack/testfiles/h5repack_layout.h5.ddl index d380201..00c74f4 100644 --- a/tools/h5repack/testfiles/h5repack_layout.h5.ddl +++ b/tools/h5repack/testfiles/h5repack_layout.h5.ddl @@ -1,129 +1,605 @@ -HDF5 "./testfiles/out-deflate_limit.h5repack_layout.h5" { +HDF5 "h5repack_layout.h5" { GROUP "/" { DATASET "dset1" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset2" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset3" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset4" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset_chunk" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } - STORAGE_LAYOUT { - CHUNKED ( 20, 10 ) - SIZE 1283 (2.494:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset_compact" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } DATASET "dset_contiguous" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } - STORAGE_LAYOUT { - CHUNKED ( 40, 20 ) - SIZE 1150 (2.783:1 COMPRESSION) - } - FILTERS { - COMPRESSION DEFLATE { LEVEL 1 } - } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR + DATA { + (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + (0,18): 18, 19, + (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + (1,16): 36, 37, 38, 39, + (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + (2,16): 56, 57, 58, 59, + (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + (3,16): 76, 77, 78, 79, + (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + (4,16): 96, 97, 98, 99, + (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + (5,13): 113, 114, 115, 116, 117, 118, 119, + (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + (6,13): 133, 134, 135, 136, 137, 138, 139, + (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + (7,13): 153, 154, 155, 156, 157, 158, 159, + (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + (8,13): 173, 174, 175, 176, 177, 178, 179, + (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + (9,13): 193, 194, 195, 196, 197, 198, 199, + (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + (10,12): 212, 213, 214, 215, 216, 217, 218, 219, + (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + (11,12): 232, 233, 234, 235, 236, 237, 238, 239, + (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + (12,12): 252, 253, 254, 255, 256, 257, 258, 259, + (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + (13,12): 272, 273, 274, 275, 276, 277, 278, 279, + (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + (14,12): 292, 293, 294, 295, 296, 297, 298, 299, + (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + (15,12): 312, 313, 314, 315, 316, 317, 318, 319, + (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + (16,12): 332, 333, 334, 335, 336, 337, 338, 339, + (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, + (17,12): 352, 353, 354, 355, 356, 357, 358, 359, + (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + (18,12): 372, 373, 374, 375, 376, 377, 378, 379, + (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + (19,12): 392, 393, 394, 395, 396, 397, 398, 399, + (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, + (20,12): 412, 413, 414, 415, 416, 417, 418, 419, + (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + (21,12): 432, 433, 434, 435, 436, 437, 438, 439, + (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, + (22,12): 452, 453, 454, 455, 456, 457, 458, 459, + (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + (23,12): 472, 473, 474, 475, 476, 477, 478, 479, + (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + (24,12): 492, 493, 494, 495, 496, 497, 498, 499, + (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + (25,12): 512, 513, 514, 515, 516, 517, 518, 519, + (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + (26,12): 532, 533, 534, 535, 536, 537, 538, 539, + (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + (27,12): 552, 553, 554, 555, 556, 557, 558, 559, + (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, + (28,12): 572, 573, 574, 575, 576, 577, 578, 579, + (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, + (29,12): 592, 593, 594, 595, 596, 597, 598, 599, + (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, + (30,12): 612, 613, 614, 615, 616, 617, 618, 619, + (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, + (31,12): 632, 633, 634, 635, 636, 637, 638, 639, + (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, + (32,12): 652, 653, 654, 655, 656, 657, 658, 659, + (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, + (33,12): 672, 673, 674, 675, 676, 677, 678, 679, + (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + (34,12): 692, 693, 694, 695, 696, 697, 698, 699, + (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + (35,12): 712, 713, 714, 715, 716, 717, 718, 719, + (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + (36,12): 732, 733, 734, 735, 736, 737, 738, 739, + (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, + (37,12): 752, 753, 754, 755, 756, 757, 758, 759, + (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, + (38,12): 772, 773, 774, 775, 776, 777, 778, 779, + (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, + (39,12): 792, 793, 794, 795, 796, 797, 798, 799 } } } diff --git a/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst b/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst new file mode 100644 index 0000000..7f9bd6e --- /dev/null +++ b/tools/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst @@ -0,0 +1,14 @@ +Objects to modify layout are... +Objects to apply filter are... + User Defined 257 +----------------------------------------- + Type Filter (Compression) Name +----------------------------------------- + group / + dset UD (1.000:1) /dset1 + dset UD (1.000:1) /dset2 + dset UD (1.000:1) /dset3 + dset UD (1.000:1) /dset4 + dset UD (1.000:1) /dset_chunk + dset UD (1.000:1) /dset_compact + dset UD (1.000:1) /dset_contiguous diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 96b508d..7dba0e5 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -109,7 +109,7 @@ static hbool_t not_comparable; if(0 == (A) && 0 == (B)) \ both_zero = TRUE; \ if(0 != (A)) \ - per = (double)ABS((double)(B - A) / (double)A); \ + per = (double)ABS((double)((B) - (A)) / (double)(A)); \ else \ not_comparable = TRUE; \ } @@ -119,16 +119,16 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if(A == 0 && B == 0) \ + if((A) == 0 && (B) == 0) \ both_zero = TRUE; \ - if(A != 0) \ - per = ABS((double)((TYPE)(B - A)) / (double)A) ; \ + if((A) != 0) \ + per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ else \ not_comparable = TRUE; \ } -# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) +#define PDIFF(a,b) (((b) > (a)) ? ((b) - (a)) : ((a) -(b))) typedef struct mcomp_t { @@ -890,9 +890,8 @@ static hsize_t diff_datum(void *_mem1, /* calculate the number of array elements */ for (u = 0, nelmts = 1; u < (unsigned)ndims; u++) nelmts *= adims[u]; - for (u = 0; u < nelmts; u++) - { - nfound+=diff_datum( + for (u = 0; u < nelmts; u++) { + nfound += diff_datum( mem1 + u * size, mem2 + u * size, /* offset */ memb_type, @@ -907,7 +906,7 @@ static hsize_t diff_datum(void *_mem1, container1_id, container2_id, ph, members); - } + } H5Tclose(memb_type); } break; diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 7b43d2e..d9a1827 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1443,8 +1443,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t offset = H5Tget_member_offset(tid, j); memb = H5Tget_member_type(tid, j); - if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) - return FAIL; + if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) { + H5Tclose(memb); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed"); + } H5Tclose(memb); } @@ -1473,8 +1475,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; /* dump the array element */ - if (render_bin_output(stream, container, memb, mem, nelmts) < 0) + if (render_bin_output(stream, container, memb, mem, nelmts) < 0) { + H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + } } H5Tclose(memb); } @@ -1493,8 +1497,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts = ((hvl_t *) mem)->len; /* dump the array element */ - if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) + if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + } } H5Tclose(memb); } @@ -1615,15 +1621,16 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, } if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - render_bin_output(stream, container, type_id, (char*)region_buf, numelem); + if(render_bin_output(stream, container, type_id, (char*)region_buf, numelem) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data region failed"); /* Render the region data element end */ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -1753,9 +1760,10 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - render_bin_output(stream, container, type_id, (char*)region_buf, npoints); + if(render_bin_output(stream, container, type_id, (char*)region_buf, npoints) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data points failed"); done: HDfree(region_buf); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index fb820ad..1265a62 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -325,7 +325,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai ctx, &buffer, &curr_pos, ncols, i, elmt_counter); } else { - if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, 1024)<0) + if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, (size_t)1024)<0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_name failed"); ctx->need_prefix = TRUE; @@ -454,7 +454,7 @@ h5tools_print_region_data_blocks(hid_t region_id, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + if((dims1 = (hsize_t *) HDmalloc((size_t)(sizeof(hsize_t) * ndims))) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); /* find the dimensions of each data space from the block coordinates */ @@ -2112,12 +2112,12 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ curr_pos = ctx->cur_column; h5tools_str_append(buffer, "H5T_STRING %s", h5tools_dump_header_format->strblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2125,10 +2125,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "%s H5T_VARIABLE;", STRSIZE); else h5tools_str_append(buffer, "%s %d;", STRSIZE, (int) size); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2165,10 +2165,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "ERROR;"); break; } - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2204,10 +2204,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "ERROR;"); break; } - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); @@ -2278,11 +2278,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "unknown_one_character_type;"); found_string_type: - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); if(H5Tclose(str_type) < 0) @@ -2325,7 +2325,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_OPAQUE: h5tools_str_append(buffer, "H5T_OPAQUE %s", h5tools_dump_header_format->structblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; { char *ttag; @@ -2334,18 +2334,18 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); HDfree(ttag); } ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); @@ -2357,20 +2357,20 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ nmembers = (unsigned)snmembers; h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; for (i = 0; i < nmembers; i++) { mname = H5Tget_member_name(type, i); if((mtype = H5Tget_member_type(type, i)) >= 0) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_print_datatype(stream, buffer, info, ctx, mtype, TRUE); h5tools_str_append(buffer, " \"%s\";", mname); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5Tclose(mtype) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); } @@ -2381,7 +2381,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); @@ -2402,11 +2402,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); @@ -2415,14 +2415,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); h5tools_str_append(buffer, ";"); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_print_enum(stream, buffer, info, ctx, type); ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); @@ -2631,9 +2631,9 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i dst_size = type_size; /* Get the names and raw values of all members */ - if(NULL == (name = (char **)HDcalloc(nmembs, sizeof(char *)))) + if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); - if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size)))) + if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size)))) H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); for (i = 0; i < nmembs; i++) { @@ -2644,7 +2644,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Convert values to native datatype */ if (native > 0) - if(H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT) < 0) + if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); /* @@ -2655,7 +2655,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Print members */ for (i = 0; i < nmembs; i++) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "\"%s\"", name[i]); @@ -2684,7 +2684,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i } h5tools_str_append(buffer, ";"); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } CATCH @@ -2752,7 +2752,7 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, if (HDstrlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2801,7 +2801,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, if (HDstrlen(h5tools_dump_header_format->dataspaceend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2839,7 +2839,7 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s %d %s", OBJID, BEGIN, oid, END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -2937,7 +2937,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", STORAGE_LAYOUT, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5D_CHUNKED == H5Pget_layout(dcpl_id)) { ctx->indent_level++; @@ -2948,12 +2948,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s ", CHUNKED); - rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); + rank = H5Pget_chunk(dcpl_id,(int)NELMTS(chsize),chsize); h5tools_str_append(&buffer, "%s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedimbegin, chsize[0]); for(i = 1; i < rank; i++) h5tools_str_append(&buffer, ", " HSIZE_T_FORMAT, chsize[i]); h5tools_str_append(&buffer, " %s", h5tools_dump_header_format->dataspacedimend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3018,7 +3018,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, else { h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3027,7 +3027,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } else if(H5D_COMPACT == H5Pget_layout(dcpl_id)) { ctx->indent_level++; @@ -3037,14 +3037,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", COMPACT); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3053,7 +3053,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } else if(H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { int next; @@ -3072,14 +3072,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", CONTIGUOUS); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; for(j = 0; j < (unsigned)next; j++) { @@ -3091,7 +3091,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size); h5tools_str_append(&buffer, " OFFSET %ld", offset); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } ctx->indent_level--; @@ -3100,7 +3100,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3109,7 +3109,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } else { haddr_t ioffset; @@ -3121,14 +3121,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", CONTIGUOUS); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer,"SIZE " HSIZE_T_FORMAT, storage_size); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3136,7 +3136,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); ioffset = H5Dget_offset(obj_id); h5tools_str_append(&buffer,"OFFSET "H5_PRINTF_HADDR_FMT, ioffset); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3145,7 +3145,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } } /*------------------------------------------------------------------------- @@ -3158,7 +3158,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3178,15 +3178,15 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, switch(filtn) { case H5Z_FILTER_DEFLATE: h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; case H5Z_FILTER_SHUFFLE: h5tools_str_append(&buffer, "%s", SHUFFLE); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; case H5Z_FILTER_FLETCHER32: h5tools_str_append(&buffer, "%s", FLETCHER32); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; case H5Z_FILTER_SZIP: { @@ -3194,7 +3194,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, szip_pixels_per_block = cd_values[1]; h5tools_str_append(&buffer, "%s %s",SZIP, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3203,7 +3203,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "PIXELS_PER_BLOCK %d", szip_pixels_per_block); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3213,7 +3213,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "MODE %s", "HARDWARE"); else if(szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) h5tools_str_append(&buffer, "MODE %s", "K13"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3223,7 +3223,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "CODING %s", "ENTROPY"); else if(szip_options_mask & H5_SZIP_NN_OPTION_MASK) h5tools_str_append(&buffer, "CODING %s", "NEAREST NEIGHBOUR"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3233,7 +3233,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "BYTE_ORDER %s", "LSB"); else if(szip_options_mask & H5_SZIP_MSB_OPTION_MASK) h5tools_str_append(&buffer, "BYTE_ORDER %s", "MSB"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(szip_options_mask & H5_SZIP_RAW_OPTION_MASK) { ctx->need_prefix = TRUE; @@ -3241,7 +3241,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "HEADER %s", "RAW"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } ctx->indent_level--; @@ -3251,16 +3251,16 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } break; case H5Z_FILTER_NBIT: h5tools_str_append(&buffer, "%s", NBIT); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; case H5Z_FILTER_SCALEOFFSET: h5tools_str_append(&buffer, "%s %s %s %d %s", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; default: /* filter do not have to be avaiable for showing registered filter info. @@ -3270,7 +3270,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, else */ h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3279,7 +3279,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "FILTER_ID %d", filtn); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(f_name[0] != '\0') { ctx->need_prefix = TRUE; @@ -3287,7 +3287,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "COMMENT %s", f_name); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } if (cd_nelmts) { ctx->need_prefix = TRUE; @@ -3298,7 +3298,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, for (j=0; jindent_level--; @@ -3307,7 +3307,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); break; }/*switch*/ } /*i*/ @@ -3319,7 +3319,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "NONE"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } ctx->indent_level--; @@ -3328,7 +3328,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); /*------------------------------------------------------------------------- * FILLVALUE @@ -3339,7 +3339,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", FILLVALUE, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3364,7 +3364,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, HDassert(0); break; } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3379,7 +3379,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); ctx->indent_level++; } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; ctx->need_prefix = TRUE; @@ -3387,7 +3387,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); /*------------------------------------------------------------------------- * ALLOCATION_TIME @@ -3398,7 +3398,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "ALLOCATION_TIME %s", BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; @@ -3421,7 +3421,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, HDassert(0); break; } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3430,7 +3430,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s", END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -3480,7 +3480,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "COMMENT \"%s\"", comment); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } /* end if */ @@ -3525,7 +3525,7 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr_name, h5tools_dump_header_format->attributeblockbegin); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(attr_id < 0) { error_msg("unable to open attribute \"%s\"\n", attr_name); @@ -3555,7 +3555,7 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, } ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); @@ -3567,7 +3567,7 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, if (HDstrlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); h5tools_str_close(&buffer); } @@ -3684,34 +3684,34 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, ncols = info->line_ncols; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->subsettingbegin, h5tools_dump_header_format->subsettingblockbegin); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->startbegin, h5tools_dump_header_format->startblockbegin); h5tools_print_dims(&buffer, sset->start.data, dims); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->startend, h5tools_dump_header_format->startblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->stridebegin, h5tools_dump_header_format->strideblockbegin); h5tools_print_dims(&buffer, sset->stride.data, dims); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->strideend, h5tools_dump_header_format->strideblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->countbegin, h5tools_dump_header_format->countblockbegin); @@ -3722,10 +3722,10 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "DEFAULT"); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->countend, h5tools_dump_header_format->countblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, 0, 0); + h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->blockbegin, h5tools_dump_header_format->blockblockbegin); @@ -3736,7 +3736,7 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tools_str_append(&buffer, "DEFAULT"); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->blockend, h5tools_dump_header_format->blockblockend); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; @@ -3824,7 +3824,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, ctx->need_prefix = TRUE; h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->databegin, h5tools_dump_header_format->datablockbegin); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); /* Print all the values. */ if(obj_data) { @@ -3845,7 +3845,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, info = &string_dataformat; datactx.indent_level++; datactx.need_prefix = TRUE; - h5tools_simple_prefix(stream, info, &datactx, 0, 0); + h5tools_simple_prefix(stream, info, &datactx, (hsize_t)0, 0); string_dataformat = *info; string_dataformat.idx_fmt = "\""; @@ -3863,7 +3863,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } H5Tclose(f_type); } @@ -3913,7 +3913,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, info = &string_dataformat; datactx.indent_level++; datactx.need_prefix = TRUE; - h5tools_simple_prefix(stream, info, &datactx, 0, 0); + h5tools_simple_prefix(stream, info, &datactx, (hsize_t)0, 0); string_dataformat = *info; string_dataformat.idx_fmt = "\""; @@ -3933,7 +3933,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } /* Reclaim any VL memory, if necessary */ @@ -3957,7 +3957,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->datablockend)) { @@ -3967,13 +3967,13 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } if(HDstrlen(h5tools_dump_header_format->dataend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataend); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if (sset && obj_data) { ctx->indent_level--; ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + h5tools_simple_prefix(stream, &outputformat, ctx, (hsize_t)0, 0); h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->subsettingblockend)) { @@ -3983,7 +3983,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, } if(HDstrlen(h5tools_dump_header_format->subsettingend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingend); - h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } h5tools_str_close(&buffer); diff --git a/tools/testfiles/h5repack_filters.h5.ddl b/tools/testfiles/h5repack_filters.h5.ddl deleted file mode 100644 index 36e65b9..0000000 --- a/tools/testfiles/h5repack_filters.h5.ddl +++ /dev/null @@ -1,13 +0,0 @@ -Objects to modify layout are... -Objects to apply filter are... - with GZIP filter - ...Found ------------------------------------------ - Type Filter (Compression) Name ------------------------------------------ - group / - dset /dset_all - dset GZIP (0.995:1) /dset_deflate - dset /dset_fletcher32 - dset /dset_nbit - dset /dset_shuffle -- cgit v0.12