From b8a8b54fda077ee6fccc084de18c14ae6e7b6bfe Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 1 Aug 2013 12:54:31 -0500 Subject: [svn-r23961] Bring revisions #23862 - 23953 from trunk to revise_chunks. h5committested. --- CMakeLists.txt | 12 +- COPYING | 6 + README.txt | 2 +- c++/src/H5CommonFG.cpp | 6 +- c++/src/Makefile.in | 2 +- config/lt_vers.am | 2 +- configure | 22 ++-- configure.ac | 2 +- fortran/src/Makefile.in | 2 +- hl/c++/src/Makefile.in | 2 +- hl/fortran/src/Makefile.in | 2 +- hl/src/Makefile.in | 2 +- release_docs/RELEASE.txt | 143 ++++++++++++---------- release_docs/USING_HDF5_VS.txt | 2 +- src/H5Opline.c | 13 +- src/H5public.h | 4 +- src/H5system.c | 153 ++++++++++++++--------- src/Makefile.in | 2 +- tools/h5diff/Makefile.am | 2 +- tools/h5diff/Makefile.in | 2 +- tools/h5dump/h5dump.c | 176 +-------------------------- tools/h5jam/h5unjam.c | 149 +++++++++-------------- tools/lib/h5tools.c | 267 ++++++++++++++++++++++++++++++++++++++++- tools/lib/h5tools.h | 8 +- vms/src/h5pubconf.h | 6 +- 25 files changed, 551 insertions(+), 438 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1a7f07..cb283a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1110,8 +1110,8 @@ INSTALL ( #----------------------------------------------------------------------------- # Configure the HDF518_Examples.cmake file and the examples #----------------------------------------------------------------------------- -OPTION (HDF5_PACK_EXAMPLES_FILE "Package the HDF5 Library Examples Compressed File" OFF) -IF (HDF5_PACK_EXAMPLES_FILE) +OPTION (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF) +IF (HDF5_PACK_EXAMPLES) CONFIGURE_FILE ( ${HDF5_RESOURCES_DIR}/HDF518_Examples.cmake.in ${HDF5_BINARY_DIR}/HDF518_Examples.cmake @ONLY @@ -1121,16 +1121,16 @@ IF (HDF5_PACK_EXAMPLES_FILE) DESTINATION ${HDF5_INSTALL_DATA_DIR} COMPONENT hdfdocuments ) - IF (EXISTS "${HDF5_EXAMPLES_COMPRESSED_PATH}/${HDF5_EXAMPLES_COMPRESSED_FILE}") + IF (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}") INSTALL ( FILES - ${HDF5_EXAMPLES_COMPRESSED_PATH}/${HDF5_EXAMPLES_COMPRESSED_FILE} + ${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED} ${HDF5_SOURCE_DIR}/release_docs/USING_CMake_Examples.txt DESTINATION ${HDF5_INSTALL_DATA_DIR} COMPONENT hdfdocuments ) - ENDIF (EXISTS "${HDF5_EXAMPLES_COMPRESSED_PATH}/${HDF5_EXAMPLES_COMPRESSED_FILE}") -ENDIF (HDF5_PACK_EXAMPLES_FILE) + ENDIF (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}") +ENDIF (HDF5_PACK_EXAMPLES) #----------------------------------------------------------------------------- # Add Document File(s) to CMake Install diff --git a/COPYING b/COPYING index 25e79e7..faa7122 100644 --- a/COPYING +++ b/COPYING @@ -87,6 +87,12 @@ and/or accompanying materials: opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes. + ----------------------------------------------------------------------------- +HDF5 is available with the SZIP compression library but SZIP is not part +of HDF5 and has separate copyright and license terms. See “Szip Compression +in HDF Products” (www.hdfgroup.org/doc_resource/SZIP/) for further details. + +----------------------------------------------------------------------------- diff --git a/README.txt b/README.txt index ab2376b..a185e73 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.157-FA_a5 currently under development +HDF5 version 1.9.160-FA_a5 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index b3889a0..0651c29 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -568,8 +568,10 @@ H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const // if H5Oget_comment_by_name returns SUCCEED, return the string comment, // otherwise, throw an exception - if( ret_value < 0 ) - throwException("getComment", "H5Oget_comment_by_name failed"); + if( ret_value < 0 ) { + delete []comment_C; + throwException("getComment", "H5Oget_comment_by_name failed"); + } H5std_string comment = H5std_string(comment_C); delete []comment_C; diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 083df6e..4793093 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -467,7 +467,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 147 +LT_VERS_REVISION = 150 LT_VERS_AGE = 0 # Include src directory diff --git a/config/lt_vers.am b/config/lt_vers.am index 42a12d6..43ee967 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 147 +LT_VERS_REVISION = 150 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index dc183b3..7f71e55 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.157-FA_a5. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.160-FA_a5. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.157-FA_a5' -PACKAGE_STRING='HDF5 1.9.157-FA_a5' +PACKAGE_VERSION='1.9.160-FA_a5' +PACKAGE_STRING='HDF5 1.9.160-FA_a5' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1486,7 +1486,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.157-FA_a5 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.160-FA_a5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1556,7 +1556,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.157-FA_a5:";; + short | recursive ) echo "Configuration of HDF5 1.9.160-FA_a5:";; esac cat <<\_ACEOF @@ -1752,7 +1752,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.157-FA_a5 +HDF5 configure 1.9.160-FA_a5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2846,7 +2846,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.157-FA_a5, which was +It was created by HDF5 $as_me 1.9.160-FA_a5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3678,7 +3678,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.157-FA_a5' + VERSION='1.9.160-FA_a5' cat >>confdefs.h <<_ACEOF @@ -31632,7 +31632,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.157-FA_a5 +HDF5 config.lt 1.9.160-FA_a5 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33762,7 +33762,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.157-FA_a5, which was +This file was extended by HDF5 $as_me 1.9.160-FA_a5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33828,7 +33828,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.157-FA_a5 +HDF5 config.status 1.9.160-FA_a5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 44d243f..87d650c 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.157-FA_a5], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.160-FA_a5], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 7b6a7a3..94b43ed 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -518,7 +518,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 147 +LT_VERS_REVISION = 150 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index e188d96..9ad806f 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -458,7 +458,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 147 +LT_VERS_REVISION = 150 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index a1b949a..c850c03 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -474,7 +474,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 147 +LT_VERS_REVISION = 150 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 9d808a2..d053903 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -457,7 +457,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 147 +LT_VERS_REVISION = 150 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 622add1..6f23def 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.157-FA_a5 currently under development +HDF5 version 1.9.160-FA_a5 currently under development INTRODUCTION @@ -417,6 +417,8 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Added const qualifier to source buffer parameters in H5Dgather and + H5D_scatter_func_t (H5Dscatter callback). (NAF - 2013/7/02) - Fixed an error involving failure to write fill values to the user's buffer when reading unallocated chunks from datasets that have a fill value set to H5D_FILL_VALUE_DEFAULT. A consequence of this @@ -1062,44 +1064,47 @@ Bug Fixes since HDF5-1.8.0 release C++ APIs -------- - - The constructor PropList::PropList(id) was fixed to act properly - according to the nature of 'id'. When 'id' is a property class id, - a new property list will be created. When 'id' id a property list id, - a copy of the property list will be made. (BMR - 2010/5/9) - - The parameters 'size' and 'bufsize' in CommonFG::getLinkval and - CommonFG::getComment, respectively, now have default values for - user's convenience. (BMR - 2009/10/23) - - NULL pointer accessing was fixed, bugzilla 1061. (BMR - 2009/10/05) - - read/write methods of DataSet and Attribute classes were fixed - to handle string correctly. (BMR - 2009/07/26) - - Fixed bug that caused segfaults in Attribute::read. (BMR - 2008/04/20) - - Fixed bug in PropList::getClassName to use portable HDfree instead - of free. (BMR - 2008/04/20) - - Fixed a design bug which allowed an Attribute object to create/modify - attributes (bugzilla #1068). The API class hierarchy was revised - to address the problem. Classes AbstractDS and Attribute are moved - out of H5Object. Class Attribute now multiply inherits from - IdComponent and AbstractDs and class DataSet from H5Object and - AbstractDs. In addition, the data member IdComponent::id was - moved into subclasses: Attribute, DataSet, DataSpace, DataType, - H5File, Group, and PropList. (BMR - 2008/08/10) - - IdComponent::dereference was incorrect and replaced as described - in "New Features" section. - (BMR - 2008/08/10) + - The constructor PropList::PropList(id) was fixed to act properly + according to the nature of 'id'. When 'id' is a property class id, + a new property list will be created. When 'id' id a property list id, + a copy of the property list will be made. (BMR - 2010/5/9) + - The parameters 'size' and 'bufsize' in CommonFG::getLinkval and + CommonFG::getComment, respectively, now have default values for + user's convenience. (BMR - 2009/10/23) + - NULL pointer accessing was fixed, bugzilla 1061. (BMR - 2009/10/05) + - read/write methods of DataSet and Attribute classes were fixed + to handle string correctly. (BMR - 2009/07/26) + - Fixed bug that caused segfaults in Attribute::read. (BMR - 2008/04/20) + - Fixed bug in PropList::getClassName to use portable HDfree instead + of free. (BMR - 2008/04/20) + - Fixed a design bug which allowed an Attribute object to create/modify + attributes (bugzilla #1068). The API class hierarchy was revised + to address the problem. Classes AbstractDS and Attribute are moved + out of H5Object. Class Attribute now multiply inherits from + IdComponent and AbstractDs and class DataSet from H5Object and + AbstractDs. In addition, the data member IdComponent::id was + moved into subclasses: Attribute, DataSet, DataSpace, DataType, + H5File, Group, and PropList. (BMR - 2008/08/10) + - IdComponent::dereference was incorrect and replaced as described + in "New Features" section. + (BMR - 2008/08/10) Testing ------- - - In some Mac system, testlibinfo.sh failed with this error: - Check file ../src/.libs/libhdf5.7.dylib - strings: object: ../src/.libs/libhdf5.7.dylib malformed object \ - (unknown load command 15) - The strings command of Mac inspects library files and older - versions of strings may not know newer library format, resulting - in errors. Fixed by sending the library file as stdin to the strings - coommand to avoid this problem. (AKC - 2013/03/08 HDFFV-8305) - - - Fixed a typo in the ERROR macro in test/testhdf5.h. It segmentation - faulted when used before. (AKC - 2013/02/12 HDFFV-8267) + - tools/h5diff/testh5diff.sh is run in every "make check", even after it + has passed in the previous run. It should not run again if there is no + code changes. Fixed. (AKC - 2013/07/19 HDFFV-8392) + - In some Mac system, testlibinfo.sh failed with this error: + Check file ../src/.libs/libhdf5.7.dylib + strings: object: ../src/.libs/libhdf5.7.dylib malformed object \ + (unknown load command 15) + The strings command of Mac inspects library files and older + versions of strings may not know newer library format, resulting + in errors. Fixed by sending the library file as stdin to the strings + coommand to avoid this problem. (AKC - 2013/03/08 HDFFV-8305) + + - Fixed a typo in the ERROR macro in test/testhdf5.h. It segmentation + faulted when used before. (AKC - 2013/02/12 HDFFV-8267) Supported Platforms @@ -1153,19 +1158,20 @@ Supported Platforms (emu) Sun Fortran 95 8.6 SunOS_sparc Sun C++ 5.12 SunOS_sparc - Windows XP Visual Studio 2008 w/ Intel Fortran 10.1 (project files) - - Windows XP x64 Visual Studio 2008 w/ Intel Fortran 10.1 (project files) - - Windows 7 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake) + Windows 7 Visual Studio 2008 w/ Intel Fortran 11 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) + Visual Studio 2012 w/ Intel Fortran 13 (cmake) Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) (cmake and autotools) - Windows 7 x64 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake) + Windows 7 x64 Visual Studio 2008 w/ Intel Fortran 11 (cmake) Visual Studio 2010 w/ Intel Fortran 12 (cmake) + Visual Studio 2012 w/ Intel Fortran 13 (cmake) Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3) compiler and gfortran) (cmake and autotools) + Windows 8 Visual Studio 2012 w/ Intel Fortran 13 (cmake) + + Windows 8 x64 Visual Studio 2012 w/ Intel Fortran 13 (cmake) Mac OS X Snow Leopard 10.6.8 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 3.2.6 Darwin Kernel Version 10.8.0 g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 3.2.6 @@ -1201,8 +1207,12 @@ Platform C F90/ F90 C++ zlib SZIP parallel F2003 parallel Solaris2.11 32-bit n y/y n y y y Solaris2.11 64-bit n y/n n y y y -Windows 7 y y/n n y y y -Windows 7 x64 y y/n n y y y +Windows 7 y y/y n y y y +Windows 7 x64 y y/y n y y y +Windows 7 Cygwin n y/n n y y y +Windows 7 x64 Cygwin n y/n n y y y +Windows 8 y y/y n y y y +Windows 8 x64 y y/y n y y y Mac OS X Snow Leopard 10.6.8 64-bit n y/y n y y y Mac OS X Lion 10.7.3 32-bit n y/y n y y n Mac OS X Lion 10.7.3 64-bit n y/y n y y y @@ -1223,6 +1233,10 @@ Solaris2.11 32-bit y y y y Solaris2.11 64-bit y y y y Windows 7 y y y y Windows 7 x64 y y y y +Windows 7 Cygwin n n n y +Windows 7 x64 Cygwin n n n y +Windows 8 y y y y +Windows 8 x64 y y y y Mac OS X Snow Leopard 10.6.8 64-bit y n y n Mac OS X Lion 10.7.3 32-bit y n y y Mac OS X Lion 10.7.3 64-bit y n y y @@ -1254,46 +1268,45 @@ The following platforms are not supported but have been tested for this release. g++ 4.6.1 20110422 gfortran 4.6.1 20110422 - Debian6.0.3 2.6.32-5-686 #1 SMP i686 GNU/Linux - gcc (Debian 4.4.5-8) 4.4.5 - GNU Fortran (Debian 4.4.5-8) 4.4.5 + Debian7.1.0 3.2.0-4-686 #1 SMP Debian 3.2.46-1 i686 GNU/Linux + gcc (Debian 4.7.2-5) 4.7.2 + GNU Fortran (Debian 4.7.2-5) 4.7.2 (cmake and autotools) - Debian6.0.3 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux - gcc (Debian 4.4.5-8) 4.4.5 - GNU Fortran (Debian 4.4.5-8) 4.4.5 + Debian7.1.0 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux + gcc (Debian 4.7.2-5) 4.7.2 + GNU Fortran (Debian 4.7.2-5) 4.7.2 (cmake and autotools) - Fedora17 3.5.2-1.fc17.i6866 #1 SMP i686 i686 i386 GNU/Linux - gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) - GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + Fedora19 3.9.9-301.fc19.i6866 #1 SMP i686 i686 i386 GNU/Linux + gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) + GNU Fortran (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) (cmake and autotools) - Fedora17 3.5.2-1.fc17.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux - gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) - GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) + Fedora19 3.9.9-301.fc19.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux + gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) + GNU Fortran (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) (cmake and autotools) - SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux + SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux gcc (SUSE Linux) 4.7.1 GNU Fortran (SUSE Linux) 4.7.1 (cmake and autotools) - SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux + SUSE 12.3 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux gcc (SUSE Linux) 4.7.1 GNU Fortran (SUSE Linux) 4.7.1 (cmake and autotools) - Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP i686 GNU/Linux - gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 - GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP i686 GNU/Linux + gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 + GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu1) 4.7.3 (cmake and autotools) - Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP x86_64 GNU/Linux - gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 - GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 + Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP x86_64 GNU/Linux + gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 + GNU Fortran (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 (cmake and autotools) - (Use optimization level -O1) Cray Linux Environment (CLE) PrgEnv-pgi/4.0.46 hopper.nersc.gov pgcc 12.5-0 64-bit target on x86-64 Linux -tp shanghai diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index bbfc501..b817f7e 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -7,7 +7,7 @@ These suggestions are for Visual Studio users. Instructions for building and testing HDF5 applications using CMake can -be found in the USING_CMake.txt file found in this folder. +be found in the USING_HDF5_CMake.txt file found in this folder. The following two sections are helpful if you do not use CMake to build your applications. diff --git a/src/H5Opline.c b/src/H5Opline.c index 1a2baa0..0a0f12a 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -183,7 +183,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, else filter->name = filter->_name; - HDstrcpy(filter->name, (const char *)p); + HDstrncpy(filter->name, (const char *)p, actual_name_length); p += name_length; } /* end if */ @@ -375,12 +375,9 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) /* Allocate space for the filter name, or use the internal buffer */ if(namelen > H5Z_COMMON_NAME_LEN) { - dst->filter[i].name = (char *)H5MM_malloc(namelen); + dst->filter[i].name = (char *)H5MM_strdup(src->filter[i].name); if(NULL == dst->filter[i].name) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter name") - - /* Copy name */ - HDstrcpy(dst->filter[i].name, src->filter[i].name); } /* end if */ else dst->filter[i].name = dst->filter[i]._name; @@ -464,7 +461,7 @@ H5O_pline_size(const H5F_t UNUSED *f, const void *mesg) } /* end else */ ret_value += 2 + /*filter identification number */ - ((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ + (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */ 2 + /*flags */ 2 + /*number of client data values */ (pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */ @@ -633,7 +630,7 @@ H5O_pline_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *s for(i = 0; i < pline->nused; i++) { char name[32]; - sprintf(name, "Filter at position %u", (unsigned)i); + HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), "Filter identification:", @@ -656,7 +653,7 @@ H5O_pline_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *s for(j = 0; j < pline->filter[i].cd_nelmts; j++) { char field_name[32]; - sprintf(field_name, "CD value %lu", (unsigned long)j); + HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name, pline->filter[i].cd_values[j]); diff --git a/src/H5public.h b/src/H5public.h index baead2d..ce37b87 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 157 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 160 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a5" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.157-FA_a5" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.160-FA_a5" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5system.c b/src/H5system.c index 2a94028..4280066 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -114,6 +114,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) char modifier[8]; int conv; char *rest, format_templ[128]; + int len; const char *s; va_list ap; @@ -138,7 +139,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) s = fmt + 1; /* Flags */ - while(HDstrchr ("-+ #", *s)) { + while(HDstrchr("-+ #", *s)) { switch(*s) { case '-': leftjust = 1; @@ -155,6 +156,9 @@ HDfprintf(FILE *stream, const char *fmt, ...) case '#': prefix = 1; break; + + default: + HDassert(0 && "Unknown format flag"); } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */ s++; } /* end while */ @@ -243,16 +247,17 @@ HDfprintf(FILE *stream, const char *fmt, ...) conv = *s++; /* Create the format template */ - sprintf(format_templ, "%%%s%s%s%s%s", (leftjust ? "-" : ""), + len = 0; + len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", (leftjust ? "-" : ""), (plussign ? "+" : ""), (ldspace ? " " : ""), (prefix ? "#" : ""), (zerofill ? "0" : "")); if(fwidth > 0) - sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); if(prec > 0) - sprintf(format_templ+HDstrlen(format_templ), ".%d", prec); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), ".%d", prec); if(*modifier) - sprintf(format_templ+HDstrlen(format_templ), "%s", modifier); - sprintf (format_templ+HDstrlen(format_templ), "%c", conv); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s", modifier); + HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv); /* Conversion */ @@ -324,31 +329,42 @@ HDfprintf(FILE *stream, const char *fmt, ...) haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ if(H5F_addr_defined(x)) { - sprintf(format_templ, "%%%s%s%s%s%s", + len = 0; + len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", (leftjust ? "-" : ""), (plussign ? "+" : ""), (ldspace ? " " : ""), (prefix ? "#" : ""), (zerofill ? "0" : "")); if(fwidth > 0) - sprintf(format_templ + HDstrlen(format_templ), "%d", fwidth); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); /*lint --e{506} Don't issue warnings about constant value booleans */ /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ - if(sizeof(x) == H5_SIZEOF_INT) - HDstrcat(format_templ, "u"); - else if(sizeof(x) == H5_SIZEOF_LONG) - HDstrcat(format_templ, "lu"); + if(sizeof(x) == H5_SIZEOF_INT) { + HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + } /* end if */ + else if(sizeof(x) == H5_SIZEOF_LONG) { + HDstrncat(format_templ, "lu", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + } /* end if */ else if(sizeof(x) == H5_SIZEOF_LONG_LONG) { - HDstrcat(format_templ, H5_PRINTF_LL_WIDTH); - HDstrcat(format_templ, "u"); + HDstrncat(format_templ, H5_PRINTF_LL_WIDTH, (sizeof(format_templ) - (size_t)(len + 1))); + len += (int)sizeof(H5_PRINTF_LL_WIDTH); + HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); + len++; } n = fprintf(stream, format_templ, x); } else { - HDstrcpy(format_templ, "%"); - if(leftjust) - HDstrcat(format_templ, "-"); + len = 0; + HDstrncpy(format_templ, "%", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + if(leftjust) { + HDstrncat(format_templ, "-", (sizeof(format_templ) - (size_t)(len + 1))); + len++; + } /* end if */ if(fwidth) - sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); - HDstrcat(format_templ, "s"); + len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); + HDstrncat(format_templ, "s", (sizeof(format_templ) - (size_t)(len + 1))); fprintf(stream, format_templ, "UNDEF"); } } @@ -457,8 +473,9 @@ HDstrtoll(const char *s, const char **rest, int base) errno = 0; if (!s || (base && (base<2 || base>36))) { - if (rest) *rest = s; - return 0; + if (rest) + *rest = s; + return 0; } /* Skip white space */ @@ -466,21 +483,21 @@ HDstrtoll(const char *s, const char **rest, int base) /* Optional minus or plus sign */ if ('+'==*s) { - s++; + s++; } else if ('-'==*s) { - sign = -1; - s++; + sign = -1; + s++; } /* Zero base prefix */ if (0==base && '0'==*s && ('x'==s[1] || 'X'==s[1])) { - base = 16; - s += 2; + base = 16; + s += 2; } else if (0==base && '0'==*s) { - base = 8; - s++; + base = 8; + s++; } else if (0==base) { - base = 10; + base = 10; } /* Digits */ @@ -488,34 +505,39 @@ HDstrtoll(const char *s, const char **rest, int base) (base>10 && ((*s>='0' && *s<='9') || (*s>='a' && *s<'a'+base-10) || (*s>='A' && *s<'A'+base-10)))) { - if (!overflow) { - int64_t digit = 0; - if (*s>='0' && *s<='9') digit = *s - '0'; - else if (*s>='a' && *s<='z') digit = (*s-'a')+10; - else digit = (*s-'A')+10; - - if (acc*base+digit < acc) { - overflow = TRUE; - } else { - acc = acc*base + digit; - } - } - s++; + if (!overflow) { + int64_t digit = 0; + + if (*s>='0' && *s<='9') + digit = *s - '0'; + else if (*s>='a' && *s<='z') + digit = (*s-'a')+10; + else + digit = (*s-'A')+10; + + if (acc*base+digit < acc) { + overflow = TRUE; + } else { + acc = acc*base + digit; + } + } + s++; } /* Overflow */ if (overflow) { - if (sign>0) { - acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1; - } else { - acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1)); - } - errno = ERANGE; + if (sign>0) { + acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1; + } else { + acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1)); + } + errno = ERANGE; } /* Return values */ acc *= sign; - if (rest) *rest = s; + if (rest) + *rest = s; return acc; } /* end HDstrtoll() */ @@ -576,12 +598,13 @@ int HDremove_all(const char *fname) { int ret_value = -1; + size_t fname_len; char *_fname; - _fname = (char *)H5MM_malloc(HDstrlen(fname) + 3); /* to accomodate ;* and null */ + fname_len = HDstrlen(fname) + 3; /* to accomodate ";*" and null terminator */ + _fname = (char *)H5MM_malloc(fname_len); if(_fname) { - HDstrcpy(_fname, fname); - HDstrcat(_fname,";*"); + HDsnprintf(_fname, fname_len, "%s;*", fname); /* Do not use HDremove; function becomes recursive (see H5private.h file)*/ remove(_fname); H5MM_xfree(_fname); @@ -723,6 +746,10 @@ H5_build_extpath(const char *name, char **extpath/*out*/) FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ + HDassert(name); + HDassert(extpath); + /* Clear external path pointer to begin with */ *extpath = NULL; @@ -738,11 +765,13 @@ H5_build_extpath(const char *name, char **extpath/*out*/) } /* end if */ else { /* relative pathname */ char *retcwd; + size_t name_len; int drive; if(NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") - if(NULL == (new_name = (char *)H5MM_strdup(name))) + name_len = HDstrlen(name) + 1; + if(NULL == (new_name = (char *)H5MM_malloc(name_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") /* @@ -754,7 +783,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) if(H5_CHECK_ABS_DRIVE(name)) { drive = name[0] - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); - HDstrcpy(new_name, &name[2]); + HDstrncpy(new_name, &name[2], name_len); } /* end if */ /* * Windows: name[0] is a '/' or '\' @@ -763,20 +792,24 @@ H5_build_extpath(const char *name, char **extpath/*out*/) * OpenVMS: does not apply */ else if(H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) { - sprintf(cwdpath, "%c:%c", (drive+'A'-1), name[0]); + HDsnprintf(cwdpath, MAX_PATH_LEN, "%c:%c", (drive + 'A' - 1), name[0]); retcwd = cwdpath; - HDstrcpy(new_name, &name[1]); + HDstrncpy(new_name, &name[1], name_len); } /* totally relative for Unix, Windows, and OpenVMS: get current working directory */ - else + else { retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN); + HDstrncpy(new_name, name, name_len); + } /* end if */ if(retcwd != NULL) { size_t cwdlen; size_t path_len; + HDassert(cwdpath); cwdlen = HDstrlen(cwdpath); HDassert(cwdlen); + HDassert(new_name); path_len = cwdlen + HDstrlen(new_name) + 2; if(NULL == (full_path = (char *)H5MM_malloc(path_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -793,7 +826,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) char *tmp = new_name; full_path[cwdlen - 1] = '\0'; - HDstrcat(full_path, ++tmp); + HDstrncat(full_path, ++tmp, HDstrlen(tmp)); } /* end if */ else HDstrncat(full_path, new_name, HDstrlen(new_name)); @@ -818,9 +851,9 @@ H5_build_extpath(const char *name, char **extpath/*out*/) done: /* Release resources */ if(cwdpath) - H5MM_xfree(cwdpath); + H5MM_xfree(cwdpath); if(new_name) - H5MM_xfree(new_name); + H5MM_xfree(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* H5_build_extpath() */ diff --git a/src/Makefile.in b/src/Makefile.in index 3087b72..2b7dd35 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -525,7 +525,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 147 +LT_VERS_REVISION = 150 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/tools/h5diff/Makefile.am b/tools/h5diff/Makefile.am index 190c083..05417f5 100644 --- a/tools/h5diff/Makefile.am +++ b/tools/h5diff/Makefile.am @@ -43,7 +43,7 @@ TEST_SCRIPT=testh5diff.sh check_PROGRAMS=$(TEST_PROG) check_SCRIPTS=$(TEST_SCRIPT) $(TEST_SCRIPT_PARA) # The parallel test script testph5diff.sh actually depends on testh5diff.sh. -SCRIPT_DEPEND=h5diff$(EXEEXT) $(H5PDIFF) $(srcdir)/testh5diff.sh +SCRIPT_DEPEND=h5diff$(EXEEXT) $(H5PDIFF) testh5diff.sh # Source files for the program h5diff_SOURCES=h5diff_main.c h5diff_common.c diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 5567ceb..9b46f4e 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -456,7 +456,7 @@ TEST_PROG = h5diffgentest TEST_SCRIPT = testh5diff.sh check_SCRIPTS = $(TEST_SCRIPT) $(TEST_SCRIPT_PARA) # The parallel test script testph5diff.sh actually depends on testh5diff.sh. -SCRIPT_DEPEND = h5diff$(EXEEXT) $(H5PDIFF) $(srcdir)/testh5diff.sh +SCRIPT_DEPEND = h5diff$(EXEEXT) $(H5PDIFF) testh5diff.sh # Source files for the program h5diff_SOURCES = h5diff_main.c h5diff_common.c diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 9b304bd..36192e0 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -481,172 +481,6 @@ table_list_free(void) } /* end table_list_free() */ /*------------------------------------------------------------------------- - * Function: set_data_output_file - * - * Purpose: Open fname as the output file for dataset raw data. - * Set rawdatastream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - * Programmer: Albert Cheng, 2000/09/30 - * - * Modifications: - * pvn June, 1, 2006. Add a switch for binary output - * - *------------------------------------------------------------------------- - */ -static int -set_data_output_file(const char *fname, int is_bin) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawdatastream is changed only when succeeded */ - - if (rawdatastream && rawdatastream != stdout) { - if (HDfclose(rawdatastream)) - HDperror("closing rawdatastream"); - else - rawdatastream = NULL; - } - - /* First check if filename is string "NULL" */ - if (fname != NULL) { - /* binary output */ - if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { - rawdatastream = f; - retvalue = SUCCEED; - } - } - else { - if ((f = HDfopen(fname, "w")) != NULL) { - rawdatastream = f; - retvalue = SUCCEED; - } - } - } - else { - rawdatastream = NULL; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- - * Function: set_attr_output_file - * - * Purpose: Open fname as the output file for attribute raw data. - * Set rawattrstream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - *------------------------------------------------------------------------- - */ -static int -set_attr_output_file(const char *fname, int is_bin) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawattrstream is changed only when succeeded */ - - if (rawattrstream && rawattrstream != stdout) { - if (HDfclose(rawattrstream)) - HDperror("closing rawattrstream"); - else - rawattrstream = NULL; - } - - /* First check if filename is string "NULL" */ - if (fname != NULL) { - if ((f = HDfopen(fname, "w")) != NULL) { - rawattrstream = f; - retvalue = SUCCEED; - } - } - else { - rawattrstream = NULL; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- - * Function: set_output_file - * - * Purpose: Open fname as the output file for raw output. - * Set rawoutstream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - *------------------------------------------------------------------------- - */ -static int -set_output_file(const char *fname) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawoutstream is changed only when succeeded */ - - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) - HDperror("closing rawoutstream"); - else - rawoutstream = NULL; - } - /* First check if filename is string "NULL" */ - if (fname != NULL) { - if ((f = HDfopen(fname, "w")) != NULL) { - rawoutstream = f; - retvalue = SUCCEED; - } - } - else { - rawoutstream = NULL; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- - * Function: set_error_file - * - * Purpose: Open fname as the error output file for dataset raw error. - * Set rawerrorstream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - *------------------------------------------------------------------------- - */ -static int -set_error_file(const char *fname) -{ - int retvalue = FAIL; - FILE *f; /* temporary holding place for the stream pointer - * so that rawerrorstream is changed only when succeeded */ - - if (rawerrorstream && rawerrorstream != stderr) { - if (HDfclose(rawerrorstream)) - HDperror("closing rawerrorstream"); - else - rawerrorstream = NULL; - } - - if ((f = HDfopen(fname, "w")) != NULL) { - rawerrorstream = f; - retvalue = SUCCEED; - } - - return retvalue; -} - -/*------------------------------------------------------------------------- * Function: set_binary_form * * Purpose: set the binary form of output by translating from a string input @@ -1186,7 +1020,7 @@ parse_start: break; case 'O': - if (set_output_file(opt_arg) < 0) { + if (h5tools_set_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -1194,20 +1028,20 @@ parse_start: case 'o': if ( bin_output ) { - if (set_data_output_file(opt_arg, 1) < 0) { + if (h5tools_set_data_output_file(opt_arg, 1) < 0) { usage(h5tools_getprogname()); goto error; } } else { if(display_attr_data && !display_data) { - if (set_attr_output_file(opt_arg, 0) < 0) { + if (h5tools_set_attr_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } } if(display_data || display_all) { - if (set_data_output_file(opt_arg, 0) < 0) { + if (h5tools_set_data_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -1229,7 +1063,7 @@ parse_start: } bin_output = TRUE; if (outfname!=NULL) { - if (set_data_output_file(outfname, 1) < 0) { + if (h5tools_set_data_output_file(outfname, 1) < 0) { /* failed to set output file */ usage(h5tools_getprogname()); goto error; diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 691e2f2..40358c6 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -27,7 +27,7 @@ hsize_t write_pad( int , hsize_t ); hsize_t compute_pad( hsize_t ); -herr_t copy_to_file( int , int , ssize_t, ssize_t ); +herr_t copy_to_file( FILE *, FILE * , ssize_t, ssize_t ); int do_delete = FALSE; char *output_file = NULL; @@ -137,20 +137,28 @@ static int parse_command_line(int argc, const char *argv[]) { int opt = FALSE; - - /* parse command line options */ + + /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch((char)opt) { case 'o': output_file = HDstrdup(opt_arg); - break; + if (output_file) + h5tools_set_data_output_file(output_file, 1); + break; case 'i': input_file = HDstrdup(opt_arg); - break; + if (input_file) + h5tools_set_input_file(input_file, 1); + break;; case 'u': ub_file = HDstrdup(opt_arg); + if (ub_file) + h5tools_set_output_file(ub_file, 1); + else + rawoutstream = stdout; break; case 'd': @@ -205,9 +213,6 @@ done: int main(int argc, const char *argv[]) { - int ifid = -1; - int ufid = -1; - int h5fid = -1; void *edata; H5E_auto2_t func; hid_t ifile = -1; @@ -222,24 +227,24 @@ main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ + /* Disable error reporting */ H5Eget_auto2(H5E_DEFAULT, &func, &edata); H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ + /* Initialize h5tools lib */ h5tools_init(); if(EXIT_FAILURE == parse_command_line(argc, argv)) goto done; if (input_file == NULL) { - /* no user block */ + /* no user block */ error_msg("missing arguemnt for HDF5 file input.\n"); help_ref_msg(stderr); h5tools_setstatus(EXIT_FAILURE); goto done; } - + testval = H5Fis_hdf5(input_file); if (testval <= 0) { @@ -283,14 +288,7 @@ main(int argc, const char *argv[]) goto done; } - ifid = HDopen(input_file,O_RDONLY,0); - if(ifid < 0) { - error_msg("unable to open input HDF5 file \"%s\"\n", input_file); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - res = HDfstat(ifid, &sbuf); + res = HDfstat(HDfileno(rawinstream), &sbuf); if(res < 0) { error_msg("Can't stat file \"%s\"\n", input_file); h5tools_setstatus(EXIT_FAILURE); @@ -305,43 +303,15 @@ main(int argc, const char *argv[]) goto done; } - if (ub_file == NULL) { - /* write to sdtout */ - ufid = HDdup(1); - } - else { - ufid = HDopen(ub_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 ); - - if (ufid < 0) { - error_msg("unable to open user block file for output\"%s\"\n", ub_file); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - if (output_file == NULL) { - h5fid = HDopen(input_file,O_WRONLY, 0); - - if (h5fid < 0) { error_msg("unable to open output HDF5 file \"%s\"\n", input_file); h5tools_setstatus(EXIT_FAILURE); goto done; - } } - else { - h5fid = HDopen(output_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 ); - - if (h5fid < 0) { - error_msg("unable to open output HDF5 file \"%s\"\n", output_file); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - - /* copy from 0 to 'usize - 1' into ufid */ + /* copy from 0 to 'usize - 1' into ufid */ if (!do_delete) { - if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) { + if(copy_to_file(rawinstream, rawoutstream, 0, (ssize_t) usize) < 0) { error_msg("unable to copy user block to output file \"%s\"\n", ub_file); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -349,34 +319,25 @@ main(int argc, const char *argv[]) } /* copy from usize to end of file into h5fid, - * starting at end of user block if present - */ - if(copy_to_file(ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) { + * starting at end of user block if present */ + if(copy_to_file(rawinstream, rawdatastream, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) { error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file); h5tools_setstatus(EXIT_FAILURE); goto done; } - + done: if(input_file) HDfree(input_file); + if(output_file) HDfree(output_file); + if(ub_file) { HDfree(ub_file); - if(ufid >= 0) - status = HDclose(ufid); - HDassert(status >= 0); - } - - if(h5fid >= 0) { - status = HDclose(h5fid); - HDassert(status >= 0); - } - if(ifid >= 0) { - status = HDclose(ifid); - HDassert(status >= 0); } + + h5tools_close(); return h5tools_getstatus(); } @@ -388,54 +349,60 @@ done: * Returns 0 on success, -1 on failure. */ herr_t -copy_to_file( int infid, int ofid, ssize_t where, ssize_t how_much ) +copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t how_much ) { static char buf[COPY_BUF_SIZE]; + off_t where = (off_t)_where; off_t to; off_t from; - ssize_t nchars = -1; - ssize_t wnchars = -1; herr_t ret_value = 0; /* nothing to copy */ if(how_much <= 0) goto done; + /* rewind */ + HDfseek(infid, 0L, 0); + from = where; to = 0; - while(how_much > 0) { - /* Seek to correct position in input file */ - HDlseek(infid,from,SEEK_SET); + size_t bytes_in = 0; /* # of bytes to read */ + size_t bytes_read = 0; /* # of bytes actually read */ + size_t bytes_wrote = 0; /* # of bytes written */ - /* Read data to buffer */ if (how_much > COPY_BUF_SIZE) - nchars = HDread(infid,buf,(unsigned)COPY_BUF_SIZE); + bytes_in = COPY_BUF_SIZE; else - nchars = HDread(infid,buf,(unsigned)how_much); - if(nchars < 0) { + bytes_in = how_much; + + /* Seek to correct position in input file */ + HDfseek(infid, from, SEEK_SET); + + /* Read data to buffer */ + bytes_read = HDfread(buf, (size_t)1, bytes_in, infid); + if(0 == bytes_read && HDferror(infid)) { ret_value = -1; goto done; } /* end if */ + if(0 == bytes_read && HDfeof(infid)) { + goto done; + } /* end if */ /* Seek to correct position in output file */ - HDlseek(ofid,to,SEEK_SET); + HDfseek(ofid, to, SEEK_SET); /* Update positions/size */ - how_much -= nchars; - from += nchars; - to += nchars; - - /* Write nchars bytes to output file */ - wnchars = nchars; - while(nchars > 0) { - wnchars = HDwrite(ofid,buf,(unsigned)nchars); - if(wnchars < 0) { - ret_value = -1; - goto done; - } /* end if */ - nchars -= wnchars; - } /* end while */ + how_much -= bytes_read; + from += bytes_read; + to += bytes_read; + + /* Write nchars bytes to output file */ + bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid); + if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */ + ret_value = -1; + goto done; + } /* end if */ } /* end while */ done: diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 3e9c43e..d229eec 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -36,10 +36,11 @@ hid_t H5tools_ERR_CLS_g = -1; hid_t H5E_tools_g = -1; hid_t H5E_tools_min_id_g = -1; int compound_data; -FILE *rawattrstream; /* should initialize to stdout but gcc moans about it */ -FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ -FILE *rawoutstream; /* should initialize to stdout but gcc moans about it */ -FILE *rawerrorstream; /* should initialize to stderr but gcc moans about it */ +FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */ +FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */ +FILE *rawinstream = NULL; /* should initialize to stdin but gcc moans about it */ +FILE *rawoutstream = NULL; /* should initialize to stdout but gcc moans about it */ +FILE *rawerrorstream = NULL; /* should initialize to stderr but gcc moans about it */ int bin_output; /* binary output */ int bin_form; /* binary form */ int region_output; /* region output */ @@ -120,6 +121,8 @@ h5tools_init(void) rawattrstream = stdout; if (!rawdatastream) rawdatastream = stdout; + if (!rawinstream) + rawinstream = stdin; if (!rawoutstream) rawoutstream = stdout; if (!rawerrorstream) @@ -172,6 +175,12 @@ h5tools_close(void) else rawdatastream = NULL; } + if (rawinstream && rawinstream != stdin) { + if (fclose(rawinstream)) + perror("closing rawinstream"); + else + rawinstream = NULL; + } if (rawoutstream && rawoutstream != stdout) { if (fclose(rawoutstream)) perror("closing rawoutstream"); @@ -198,6 +207,254 @@ h5tools_close(void) } /*------------------------------------------------------------------------- + * Function: h5tools_set_data_output_file + * + * Purpose: Open fname as the output file for dataset raw data. + * Set rawdatastream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + * Programmer: Albert Cheng, 2000/09/30 + * + * Modifications: + * pvn June, 1, 2006. Add a switch for binary output + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_data_output_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawdatastream is changed only when succeeded */ + + if (rawdatastream && rawdatastream != stdout) { + if (HDfclose(rawdatastream)) + HDperror("closing rawdatastream"); + else + rawdatastream = NULL; + } + + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawdatastream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawdatastream = f; + retvalue = SUCCEED; + } + } + } + else { + rawdatastream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_attr_output_file + * + * Purpose: Open fname as the output file for attribute raw data. + * Set rawattrstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_attr_output_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawattrstream is changed only when succeeded */ + + if (rawattrstream && rawattrstream != stdout) { + if (HDfclose(rawattrstream)) + HDperror("closing rawattrstream"); + else + rawattrstream = NULL; + } + + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawattrstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawattrstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawattrstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_input_file + * + * Purpose: Open fname as the input file for raw input. + * Set rawinstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_input_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawinstream is changed only when succeeded */ + + if (rawinstream && rawinstream != stdin) { + if (HDfclose(rawinstream)) + HDperror("closing rawinstream"); + else + rawinstream = NULL; + } + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "rb")) != NULL) { + rawinstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "r")) != NULL) { + rawinstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawinstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_output_file + * + * Purpose: Open fname as the output file for raw output. + * Set rawoutstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_output_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ + + if (rawoutstream && rawoutstream != stdout) { + if (HDfclose(rawoutstream)) + HDperror("closing rawoutstream"); + else + rawoutstream = NULL; + } + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawoutstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawoutstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_set_error_file + * + * Purpose: Open fname as the error output file for dataset raw error. + * Set rawerrorstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +int +h5tools_set_error_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawerrorstream is changed only when succeeded */ + + if (rawerrorstream && rawerrorstream != stderr) { + if (HDfclose(rawerrorstream)) + HDperror("closing rawerrorstream"); + else + rawerrorstream = NULL; + } + + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawerrorstream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawerrorstream = f; + retvalue = SUCCEED; + } + } + } + else { + rawerrorstream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- * Audience: Private * Chapter: H5Tools Library * Purpose: Get a FAPL for a driver @@ -1468,7 +1725,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, * hssize_t npoints is the number of points in the region *------------------------------------------------------------------------- */ -static int +int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container, int ndims, hid_t type_id, hssize_t npoints) diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 8e5b9c8..47e1f41 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -541,6 +541,7 @@ H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */ H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */ H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ +H5TOOLS_DLLVAR FILE *rawinstream; /* input stream for raw input */ H5TOOLS_DLLVAR FILE *rawoutstream; /* output stream for raw output */ H5TOOLS_DLLVAR FILE *rawerrorstream; /* output stream for raw error */ H5TOOLS_DLLVAR int bin_output; /* binary output */ @@ -558,6 +559,11 @@ H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */ /* Definitions of useful routines */ H5TOOLS_DLL void h5tools_init(void); H5TOOLS_DLL void h5tools_close(void); +H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin); +H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin); H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, const char *driver, char *drivername, size_t drivername_len); H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type); @@ -577,8 +583,6 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_form h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum); H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts); -H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index f88ddbe..ec584b7 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -511,7 +511,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.157-FA_a5" +#define H5_PACKAGE_STRING "HDF5 1.9.160-FA_a5" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -520,7 +520,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.157-FA_a5" +#define H5_PACKAGE_VERSION "1.9.160-FA_a5" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -683,7 +683,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.157-FA_a5" +#define H5_VERSION "1.9.160-FA_a5" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12