From 3d5aa0440f457cefec75fee5f3782a054b9a30e5 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 24 Oct 2013 18:21:43 -0500 Subject: [svn-r24356] Bring revision #24337 from revise_chunks. h5committested. --- CMakeLists.txt | 3 +- README.txt | 15 +- bin/cmakehdf5 | 30 +- c++/examples/CMakeLists.txt | 20 + c++/examples/CMakeTests.cmake | 32 ++ c++/examples/Makefile.am | 3 + c++/examples/Makefile.in | 3 + c++/examples/h5tutr_cmprss.cpp | 2 +- c++/examples/h5tutr_crtatt.cpp | 2 +- c++/examples/h5tutr_crtdat.cpp | 2 +- c++/examples/h5tutr_crtgrp.cpp | 2 +- c++/examples/h5tutr_crtgrpar.cpp | 2 +- c++/examples/h5tutr_crtgrpd.cpp | 2 +- c++/examples/h5tutr_extend.cpp | 3 +- c++/examples/h5tutr_rdwt.cpp | 14 +- c++/examples/h5tutr_subset.cpp | 2 +- c++/src/H5AbstractDs.h | 13 +- c++/src/H5ArrayType.h | 7 +- c++/src/H5AtomType.h | 12 +- c++/src/H5Attribute.h | 10 + c++/src/H5CommonFG.h | 10 +- c++/src/H5CompType.h | 7 +- c++/src/H5CppDoc.h | 22 +- c++/src/H5DataSet.h | 21 +- c++/src/H5DataSpace.h | 6 +- c++/src/H5DataType.cpp | 43 +-- c++/src/H5DataType.h | 13 +- c++/src/H5DcreatProp.h | 4 + c++/src/H5DxferProp.h | 4 + c++/src/H5EnumType.h | 1 + c++/src/H5Exception.h | 13 +- c++/src/H5FaccProp.h | 2 +- c++/src/H5FcreatProp.h | 2 +- c++/src/H5File.cpp | 30 +- c++/src/H5File.h | 18 +- c++/src/H5FloatType.h | 1 + c++/src/H5Group.cpp | 12 +- c++/src/H5Group.h | 11 +- c++/src/H5IdComponent.h | 12 +- c++/src/H5IntType.h | 1 + c++/src/H5Library.h | 6 + c++/src/H5Location.cpp | 18 +- c++/src/H5Location.h | 26 +- c++/src/H5Object.h | 6 + c++/src/H5PredType.cpp | 14 +- c++/src/H5PredType.h | 45 ++- c++/src/H5PropList.h | 1 + c++/src/H5StrType.h | 1 + c++/src/H5VarLenType.h | 4 +- c++/src/Makefile.in | 2 +- c++/test/tfile.cpp | 55 ++- 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/H5LTanalyze.c | 9 +- hl/src/H5PT.c | 2 +- hl/src/Makefile.in | 2 +- release_docs/INSTALL_CMake.txt | 66 ++-- release_docs/RELEASE.txt | 25 +- release_docs/USING_HDF5_CMake.txt | 22 +- src/H5.c | 2 +- src/H5A.c | 1 - src/H5ACprivate.h | 3 +- src/H5B2cache.c | 6 +- src/H5Dint.c | 1 - src/H5E.c | 3 - src/H5F.c | 22 +- src/H5FD.c | 1 - src/H5FS.c | 6 +- src/H5FSdbg.c | 2 +- src/H5FSpkg.h | 6 +- src/H5FSprivate.h | 6 +- src/H5FSsection.c | 2 +- src/H5G.c | 1 - src/H5Gint.c | 2 +- src/H5Gname.c | 4 +- src/H5HFpkg.h | 2 +- src/H5HFspace.c | 2 +- src/H5HGcache.c | 2 +- src/H5I.c | 775 ++++++++++++++++++-------------------- src/H5Iprivate.h | 5 - src/H5Pfapl.c | 2 +- src/H5Pint.c | 2 - src/H5R.c | 1 - src/H5S.c | 1 - src/H5SL.c | 43 ++- src/H5SLprivate.h | 1 + src/H5T.c | 1 - src/H5detect.c | 4 +- src/H5private.h | 3 + src/H5public.h | 6 +- src/H5system.c | 4 +- src/H5win32defs.h | 2 +- src/Makefile.in | 2 +- test/big.c | 6 +- test/file_image.c | 2 +- test/tfile.c | 97 +++++ test/ttsafe.c | 80 ++-- tools/h5diff/h5diffgentest.c | 2 +- tools/h5repack/h5repack_main.c | 3 +- tools/lib/h5diff_array.c | 12 +- tools/lib/h5tools.c | 24 +- tools/lib/h5tools.h | 2 +- tools/lib/h5tools_str.c | 4 +- tools/lib/h5trav.c | 2 +- vms/src/h5pubconf.h | 6 +- 109 files changed, 1062 insertions(+), 852 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fde7616..da003c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,11 +185,12 @@ STRING (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._]*) #----------------------------------------------------------------------------- FILE (READ ${HDF5_SOURCE_DIR}/config/lt_vers.am _lt_vers_am_contents) STRING (REGEX REPLACE ".*LT_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" - "\\1" H5_SOVERS_MAJOR ${_lt_vers_am_contents}) + "\\1" H5_SOVERS_INTERFACE ${_lt_vers_am_contents}) STRING (REGEX REPLACE ".*LT_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_MINOR ${_lt_vers_am_contents}) STRING (REGEX REPLACE ".*LT_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_RELEASE ${_lt_vers_am_contents}) +MATH(EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE}) MESSAGE (STATUS "SOVERSION: ${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") #----------------------------------------------------------------------------- diff --git a/README.txt b/README.txt index 3c61d70..a228894 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.165-swmr_chksum0 currently under development +HDF5 version 1.9.167-swmr_chksum0 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ @@ -21,20 +21,17 @@ The following mailing lists are currently set up for HDF5 Library users: hdf-forum - For general discussion of the HDF5 library with other users. - hdf5dev - For discussion of the HDF5 library development - with developers and other interested parties. - -To subscribe to a list, send mail to "-subscribe@hdfgroup.org". +To subscribe to a list, send mail to "-subscribe@lists.hdfgroup.org". where is the name of the list. For example, send a request to subscribe to the 'news' mail list to the following address: - news-subscribe@hdfgroup.org + news-subscribe@lists.hdfgroup.org -Messages to be sent to the list should be sent to "@hdfgroup.org". +Messages sent to the list should be addressed to "@lists.hdfgroup.org". Periodic code snapshots are provided at the following URL: ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf5/snapshots -Please read the README.txt file in that directory before working with a library -snapshot. +Please read the README.txt file in that directory before working with a +library snapshot. The HDF5 website is located at http://hdfgroup.org/HDF5/ diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 874df5d..97f45ed 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -14,6 +14,8 @@ DPRINT=: progname=`basename $0` # program name cminfile="cmakemin.$$" # Cmake minimum file cfgfile=$progname.$$ # configure file +ctest_log=ctest.log # output of ctest script +install_log=install.log # output of installation $DPRINT $cfgfile # Remove temporary generated files if exit 0 @@ -36,7 +38,8 @@ TIMESTAMP # Explain what and where log files are. cat <.log: output of configure LastBuild_.log: output of build @@ -219,13 +222,36 @@ if (NOT LOCAL_SKIP_TEST) endif() message ("test DONE") endif (NOT LOCAL_SKIP_TEST) +if(NOT LOCAL_MEMCHECK_TEST) + ##----------------------------------------------- + ## Package the product + ##----------------------------------------------- + execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + RESULT_VARIABLE cpackResult + OUTPUT_VARIABLE cpackLog + ERROR_VARIABLE cpackLog.err + ) + file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") +endif(NOT LOCAL_MEMCHECK_TEST) +#----------------------------------------------------------------------------- message ("DONE") EOF # Run ctest -ctest -S $cfgfile -C Release -V -O ctest.log +ctest -S $cfgfile -C Release -V -O $ctest_log +exit_code=$? +if [ $exit_code = 0 ]; then + echo CTest script completed without error +else + echo Error encountered CTest script +fi +# Using HDF5-*.sh because actual name is unavailable +install_sh=HDF5-*.sh +echo installing with $install_sh ... +./$install_sh --skip-license > $install_log exit_code=$? if [ $exit_code = 0 ]; then echo Complete without error diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index c25b98c..c79f6c2 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -20,6 +20,18 @@ SET (examples h5group ) +SET (tutr_examples + h5tutr_cmprss + h5tutr_crtdat + h5tutr_crtatt + h5tutr_crtgrpar + h5tutr_crtgrp + h5tutr_crtgrpd + h5tutr_extend + h5tutr_rdwt + h5tutr_subset +) + FOREACH (example ${examples}) ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE}) @@ -28,6 +40,14 @@ FOREACH (example ${examples}) SET_TARGET_PROPERTIES (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) ENDFOREACH (example ${examples}) +FOREACH (example ${tutr_examples}) + ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) + TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE}) + TARGET_C_PROPERTIES (cpp_ex_${example} " " " ") + TARGET_LINK_LIBRARIES (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + SET_TARGET_PROPERTIES (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) +ENDFOREACH (example ${tutr_examples}) + IF (BUILD_TESTING) INCLUDE (CMakeTests.cmake) ENDIF (BUILD_TESTING) diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index 47f8ffa..b39dcfe 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -27,3 +27,35 @@ ENDIF (NOT "${last_test}" STREQUAL "") SET (last_test "cpp_ex_${example}") ENDFOREACH (example ${examples}) +#the following dependicies are handled by the order of the files +# SET_TESTS_PROPERTIES(cpp_ex_readdata PROPERTIES DEPENDS cpp_ex_create) +# SET_TESTS_PROPERTIES(cpp_ex_chunks PROPERTIES DEPENDS cpp_ex_extend_ds) + + ADD_TEST ( + NAME cpp_ex_tutr-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + h5tutr_cmprss.h5 + h5tutr_dset.h5 + h5tutr_extend.h5 + h5tutr_group.h5 + h5tutr_groups.h5 + h5tutr_subset.h5 + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (cpp_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "cpp_ex_tutr-clear-objects") + + FOREACH (example ${tutr_examples}) + ADD_TEST (NAME cpp_ex_${example} COMMAND $) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (cpp_ex_${example} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "cpp_ex_${example}") + ENDFOREACH (example ${tutr_examples}) +#the following dependicies are handled by the order of the files +# SET_TESTS_PROPERTIES(cpp_ex_h5tutr_crtatt PROPERTIES DEPENDS cpp_ex_h5tutr_crtdat) +# SET_TESTS_PROPERTIES(cpp_ex_h5tutr_rdwt PROPERTIES DEPENDS cpp_ex_h5tutr_crtdat) +# SET_TESTS_PROPERTIES(cpp_ex_h5tutr_crtgrpd PROPERTIES DEPENDS cpp_ex_h5tutr_crtgrpar) + \ No newline at end of file diff --git a/c++/examples/Makefile.am b/c++/examples/Makefile.am index f479776..9e616f7 100644 --- a/c++/examples/Makefile.am +++ b/c++/examples/Makefile.am @@ -40,6 +40,9 @@ INSTALL_SCRIPT_FILES = run-c++-ex.sh # Some of the examples depend on files created by running other examples readdata.chkexe_: create.chkexe_ chunks.chkexe_: extend_ds.chkexe_ +h5tutr_rdwt.chkexe_: h5tutrcrtdat.chkexe +h5tutrcrtatt.chkexe_: h5tutrcrtdat.chkexe +h5tutr_crtgrpd.chkexe_: h5tutr_crtgrpar.chkexe # Tell conclude.am that these are C++ tests. CXX_API=yes diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index f392787..dee7c11 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -659,6 +659,9 @@ help: # Some of the examples depend on files created by running other examples readdata.chkexe_: create.chkexe_ chunks.chkexe_: extend_ds.chkexe_ +h5tutr_rdwt.chkexe_: h5tutrcrtdat.chkexe +h5tutrcrtatt.chkexe_: h5tutrcrtdat.chkexe +h5tutr_crtgrpd.chkexe_: h5tutr_crtgrpar.chkexe # How to build programs using h5c++ $(EXTRA_PROG): $(H5CPP) diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp index 7db73c4..e9c87f1 100644 --- a/c++/examples/h5tutr_cmprss.cpp +++ b/c++/examples/h5tutr_cmprss.cpp @@ -31,7 +31,7 @@ #endif // H5_NO_STD #endif -const H5std_string FILE_NAME("cmprss.h5"); +const H5std_string FILE_NAME("h5tutr_cmprss.h5"); const H5std_string DATASET_NAME("Compressed_Data"); const int DIM0 = 100; const int DIM1 = 20; diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp index 651dc69..df8ca5a 100644 --- a/c++/examples/h5tutr_crtatt.cpp +++ b/c++/examples/h5tutr_crtatt.cpp @@ -27,7 +27,7 @@ using namespace H5; #endif -const H5std_string FILE_NAME( "dset.h5" ); +const H5std_string FILE_NAME( "h5tutr_dset.h5" ); const H5std_string DATASET_NAME( "dset" ); const H5std_string ATTR_NAME( "Units" ); diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp index d7f887e..c767f72 100644 --- a/c++/examples/h5tutr_crtdat.cpp +++ b/c++/examples/h5tutr_crtdat.cpp @@ -27,7 +27,7 @@ using namespace H5; #endif -const H5std_string FILE_NAME("dset.h5"); +const H5std_string FILE_NAME("h5tutr_dset.h5"); const H5std_string DATASET_NAME("dset"); const int NX = 4; // dataset dimensions const int NY = 6; diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp index bbafd10..3db4e72 100644 --- a/c++/examples/h5tutr_crtgrp.cpp +++ b/c++/examples/h5tutr_crtgrp.cpp @@ -31,7 +31,7 @@ #endif // H5_NO_STD #endif -const H5std_string FILE_NAME("group.h5"); +const H5std_string FILE_NAME("h5tutr_group.h5"); int main(void) { diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp index d58dff6..f6e031f 100644 --- a/c++/examples/h5tutr_crtgrpar.cpp +++ b/c++/examples/h5tutr_crtgrpar.cpp @@ -31,7 +31,7 @@ #endif // H5_NO_STD #endif -const H5std_string FILE_NAME("groups.h5"); +const H5std_string FILE_NAME("h5tutr_groups.h5"); int main(void) { diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp index fdb9108..f0bde52 100644 --- a/c++/examples/h5tutr_crtgrpd.cpp +++ b/c++/examples/h5tutr_crtgrpd.cpp @@ -31,7 +31,7 @@ #endif // H5_NO_STD #endif -const H5std_string FILE_NAME("groups.h5"); +const H5std_string FILE_NAME("h5tutr_groups.h5"); const H5std_string DATASET_NAME1("/MyGroup/dset1"); const H5std_string DATASET_NAME2("dset2"); const int RANK = 2; diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp index c3a18d7..432ca5e 100644 --- a/c++/examples/h5tutr_extend.cpp +++ b/c++/examples/h5tutr_extend.cpp @@ -31,7 +31,7 @@ #endif // H5_NO_STD #endif -const H5std_string FILE_NAME("extend.h5"); +const H5std_string FILE_NAME("h5tutr_extend.h5"); const H5std_string DATASETNAME("ExtendibleArray"); int main (void) @@ -130,6 +130,7 @@ int main (void) if (H5D_CHUNKED == prop.getLayout()) rank_chunk = prop.getChunk(rank, chunk_dimsr); + cout << "rank chunk = " << rank_chunk << endl;; memspace = new DataSpace(rank, dimsr, NULL); dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp index e6e45b7..68c28ca 100644 --- a/c++/examples/h5tutr_rdwt.cpp +++ b/c++/examples/h5tutr_rdwt.cpp @@ -27,8 +27,8 @@ using namespace H5; #endif -const H5std_string FILE_NAME( "dset.h5" ); -const H5std_string DATASET_NAME( "dset" ); +const H5std_string FILE_NAME("h5tutr_dset.h5"); +const H5std_string DATASET_NAME("dset"); const int DIM0 = 4; // dataset dimensions const int DIM1 = 6; @@ -52,24 +52,24 @@ int main (void) Exception::dontPrint(); // Open an existing file and dataset. - H5File file( FILE_NAME, H5F_ACC_RDWR ); - DataSet dataset = file.openDataSet( DATASET_NAME ); + H5File file(FILE_NAME, H5F_ACC_RDWR); + DataSet dataset = file.openDataSet(DATASET_NAME); // Write the data to the dataset using default memory space, file // space, and transfer properties. - dataset.write( data, PredType::NATIVE_INT ); + dataset.write(data, PredType::NATIVE_INT); } // end of try block // catch failure caused by the H5File operations - catch( FileIException error ) + catch(FileIException error) { error.printError(); return -1; } // catch failure caused by the DataSet operations - catch( DataSetIException error ) + catch(DataSetIException error) { error.printError(); return -1; diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp index 77174ab..ad52747 100644 --- a/c++/examples/h5tutr_subset.cpp +++ b/c++/examples/h5tutr_subset.cpp @@ -31,7 +31,7 @@ #endif // H5_NO_STD #endif -const H5std_string FILE_NAME("subset.h5"); +const H5std_string FILE_NAME("h5tutr_subset.h5"); const H5std_string DATASET_NAME("IntArray"); const int RANK = 2; diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 6635f78..01d05b8 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -14,11 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// Class AbstractDs is an abstract base class, from which Attribute and -// DataSet inherit. It provides the services that are common to both -// Attribute and DataSet. It also inherits from H5Object and passes down -// the services that H5Object provides. - #ifndef __AbstractDs_H #define __AbstractDs_H @@ -33,6 +28,14 @@ class FloatType; class IntType; class StrType; class VarLenType; + +/*! \class AbstractDs + \brief AbstractDs is an abstract base class, inherited by Attribute + and DataSet. + + It provides a collection of services that are common to both Attribute + and DataSet. AbstractDs inherits from H5Object. +*/ class H5_DLLCPP AbstractDs { public: // Gets a copy the datatype of that this abstract dataset uses. diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index d2e3c29..511126e 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -14,9 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// Class ArrayType inherits from DataType and provides wrappers for the -// HDF5 C's Array Datatypes. - #ifndef __H5ArrayType_H #define __H5ArrayType_H @@ -24,6 +21,10 @@ namespace H5 { #endif +/*! \class ArrayType + \brief Class ArrayType inherits from DataType and provides wrappers for + the HDF5's Array Datatypes. +*/ class H5_DLLCPP ArrayType : public DataType { public: // Constructor that creates a new array data type based on the diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index e8d6513..792312a 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -14,11 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// Class AtomType is a base class, from which IntType, FloatType, StrType, -// and PredType inherit. It provides the services that are common to these -// subclasses. It also inherits from DataType and passes down the -// services that are common to all the datatypes. - #ifndef __H5AtomType_H #define __H5AtomType_H @@ -26,6 +21,13 @@ namespace H5 { #endif +/*! \class AtomType + \brief AtomType is a base class, inherited by IntType, FloatType, + StrType, and PredType. + + AtomType provides operations on HDF5 atomic datatypes. It also inherits + from DataType. +*/ class H5_DLLCPP AtomType : public DataType { public: // Returns the byte order of an atomic datatype. diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 2d01205..dbfbbb2 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -21,6 +21,14 @@ namespace H5 { #endif +/*! \class Attribute + \brief Class Attribute operates on HDF5 attributes. + + An attribute has many characteristics similar to a dataset, thus both + Attribute and DataSet are derivatives of AbstractDs. Attribute also + inherits from IdComponent because an attribute is an HDF5 component that + is identified by an identifier. +*/ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { public: // Closes this attribute. @@ -74,8 +82,10 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent { virtual ~Attribute(); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the attribute id. virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS private: hid_t id; // HDF5 attribute id diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 1748d1d..2f10e8e 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -14,10 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// CommonFG is a protocol class. Its existence is simply to provide the -// common services that are provided by H5File and Group. The file or -// group in the context of this class is referred to as 'location'. - #ifndef __CommonFG_H #define __CommonFG_H @@ -29,6 +25,12 @@ class Group; class H5File; class ArrayType; class VarLenType; + +/*! \class CommonFG + \brief \i CommonFG is an abstract base class of H5File and H5Group. + + It provides common operations of H5File and H5Group. +*/ class H5_DLLCPP CommonFG { public: // Creates a new group at this location which can be a file diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 16ae839..3d6a62f 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -14,9 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// Class CompType inherits from DataType and provides accesses to a compound -// datatype. - #ifndef __H5CompType_H #define __H5CompType_H @@ -24,6 +21,10 @@ namespace H5 { #endif +/*! \class CompType + \brief CompType is a derivative of a DataType and operates on HDF5 + compound datatypes. +*/ class H5_DLLCPP CompType : public DataType { public: // Default constructor diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h index baeca64..f3ed040 100644 --- a/c++/src/H5CppDoc.h +++ b/c++/src/H5CppDoc.h @@ -37,17 +37,17 @@ * closely represent the interfaces of the HDF5 APIs, as followed: * * \verbatim - HDF5 C APIs C++ Classes - ----------- ----------- - Attribute Interface (H5A) Attribute - Datasets Interface (H5D) DataSet - Error Interface (H5E) Exception - File Interface (H5F) H5File - Group Interface (H5G) Group - Identifier Interface (H5I) IdComponent - Property List Interface (H5P) PropList and subclasses - Dataspace Interface (H5S) DataSpace - Datatype Interface (H5T) DataType and subclasses + HDF5 C APIs C++ Classes + ----------- ----------- + Attribute Interface (H5A) Attribute + Datasets Interface (H5D) DataSet + Error Interface (H5E) Exception + File Interface (H5F) H5File + Group Interface (H5G) Group + Identifier Interface (H5I) IdComponent + Property List Interface (H5P) PropList and subclasses + Dataspace Interface (H5S) DataSpace + Datatype Interface (H5T) DataType and subclasses \endverbatim * \section install_sec Installation * diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index a3a6a76..92c651c 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -14,8 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// Class DataSet inherits from AbstractDs and provides accesses to a dataset. - #ifndef __H5DataSet_H #define __H5DataSet_H @@ -23,6 +21,13 @@ namespace H5 { #endif +/*! \class DataSet + \brief Class DataSet operates on HDF5 datasets. + + An datasets has many characteristics similar to an attribute, thus both + Attribute and DataSet are derivatives of AbstractDs. DataSet also + inherits from H5Object because a dataset is an HDF5 object. +*/ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { public: // Close this dataset. @@ -98,6 +103,12 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Destructor: properly terminates access to this dataset. virtual ~DataSet(); + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Sets the dataset id. + virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS + private: hid_t id; // HDF5 dataset id @@ -110,12 +121,6 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs { // Reads variable or fixed len strings from this dataset. void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const; - - protected: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Sets the dataset id. - virtual void p_setId(const hid_t new_id); -#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 1ea7188..05ee70c 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -21,6 +21,7 @@ namespace H5 { #endif +//! Class DataSpace operates on HDF5 dataspaces. class H5_DLLCPP DataSpace : public IdComponent { public: // Default DataSpace objects @@ -118,15 +119,14 @@ class H5_DLLCPP DataSpace : public IdComponent { // Destructor: properly terminates access to this dataspace. virtual ~DataSpace(); - private: - hid_t id; // HDF5 dataspace id - protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the dataspace id. virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS + private: + hid_t id; // HDF5 dataspace id }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index be05623..00aa5f4 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -95,7 +95,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() // Function: DataType overload constructor - dereference ///\brief Given a reference, ref, to an hdf5 group, creates a /// DataType object -///\param h5file - IN: Location referenced object is in +///\param loc - IN: Location referenced object is in ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::ReferenceException @@ -106,8 +106,6 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object() //-------------------------------------------------------------------------- DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - /* H5Location::dereference(loc, ref, ref_type, plist); - */ id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -127,13 +125,6 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); - /* try { - id = p_dereference(attr.getId(), ref, ref_type, plist); - } catch (ReferenceException deref_error) { - throw ReferenceException("DataType constructor - located by an Attribute", - deref_error.getDetailMsg()); - } - */ } //-------------------------------------------------------------------------- @@ -268,38 +259,12 @@ void DataType::p_commit(hid_t loc_id, const char* name) // Function: DataType::commit ///\brief Commits a transient datatype to a file, creating a new /// named datatype -///\param loc - IN: A file -///\param name - IN: Name of the datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DataType::commit(H5File& loc, const char* name) -{ - p_commit(loc.getLocId(), name); -} - -//-------------------------------------------------------------------------- -// Function: DataType::commit -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void DataType::commit(H5File& loc, const H5std_string& name) -{ - p_commit(loc.getLocId(), name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: DataType::commit -///\brief Commits a transient datatype to a file, creating a new -/// named datatype -///\param loc - IN: Either a group, dataset, named datatype, or attribute. +///\param loc - IN: A location (file, dataset, datatype, or group) ///\param name - IN: Name of the datatype ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Jan, 2007 //-------------------------------------------------------------------------- -void DataType::commit(H5Object& loc, const char* name) +void DataType::commit(H5Location& loc, const char* name) { p_commit(loc.getId(), name); } @@ -311,7 +276,7 @@ void DataType::commit(H5Object& loc, const char* name) /// argument \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::commit(H5Object& loc, const H5std_string& name) +void DataType::commit(H5Location& loc, const H5std_string& name) { p_commit(loc.getId(), name.c_str()); } diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 104eed4..c5c8a7d 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -21,6 +21,13 @@ namespace H5 { #endif +/*! \class DataType + \brief Class DataType provides generic operations on HDF5 datatypes. + + DataType inherits from H5Object because a named datatype is an HDF5 + object and is a base class of ArrayType, AtomType, CompType, EnumType, + and VarLenType. +*/ class H5_DLLCPP DataType : public H5Object { public: // Creates a datatype given its class and size @@ -47,10 +54,8 @@ class H5_DLLCPP DataType : public H5Object { // Commits a transient datatype to a file; this datatype becomes // a named datatype which can be accessed from the location. - void commit( H5File& loc, const char* name); - void commit( H5File& loc, const H5std_string& name); - void commit( H5Object& loc, const char* name); - void commit( H5Object& loc, const H5std_string& name); + void commit(H5Location& loc, const char* name); + void commit(H5Location& loc, const H5std_string& name); // Determines whether this datatype is a named datatype or // a transient datatype. diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 385bc61..7434b9b 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -21,6 +21,10 @@ namespace H5 { #endif +/*! \class DSetCreatPropList + \brief Class DSetCreatPropList represents the dataset creation property + list. +*/ class H5_DLLCPP DSetCreatPropList : public PropList { public: // Default dataset creation property list. diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index b136ba4..3c2a616 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -21,6 +21,10 @@ namespace H5 { #endif +/*! \class DSetMemXferPropList + \brief Class DSetMemXferPropList represents the dataset memory and + transfer property list. +*/ class H5_DLLCPP DSetMemXferPropList : public PropList { public: static const DSetMemXferPropList DEFAULT; diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 71e36c3..fe36e8b 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -21,6 +21,7 @@ namespace H5 { #endif +//! Class EnumType operates on HDF5 enum datatypes. class H5_DLLCPP EnumType : public DataType { public: diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 8b12abc..30fe537 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -28,6 +28,11 @@ namespace H5 { #endif #endif +/*! \class Exception + \brief Exception provides wrappers of HDF5 error handling functions. + + Many classes are derived from Exception for specific HDF5 C interfaces. +*/ class H5_DLLCPP Exception { public: // Creates an exception with a function name where the failure occurs @@ -78,13 +83,13 @@ class H5_DLLCPP Exception { // virtual Destructor virtual ~Exception(); - private: - H5std_string detail_message; - H5std_string func_name; - protected: // Default value for detail_message static const char DEFAULT_MSG[]; + + private: + H5std_string detail_message; + H5std_string func_name; }; class H5_DLLCPP FileIException : public Exception { diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index 040b3e9..5b56f6e 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -21,7 +21,7 @@ namespace H5 { #endif -// class for file access properties +//! Class FileAccPropList represents the HDF5 file access property list. class H5_DLLCPP FileAccPropList : public PropList { public: static const FileAccPropList DEFAULT; diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index b11be62..4fe51a9 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -21,7 +21,7 @@ namespace H5 { #endif -// class for file access properties +//! Class FileCreatPropList represents the HDF5 file create property list. class H5_DLLCPP FileCreatPropList : public PropList { public: // Default file creation property list. diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 77dd7be..615c1cb 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -163,7 +163,7 @@ H5File::H5File(const H5File& original) : H5Location(original) } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 +// Function: H5File::isHdf5 (static) ///\brief Determines whether a file in HDF5 format. (Static) ///\param name - IN: Name of the file ///\return true if the file is in HDF5 format, and false, otherwise @@ -186,7 +186,7 @@ bool H5File::isHdf5(const char* name) } //-------------------------------------------------------------------------- -// Function: H5File::isHdf5 +// Function: H5File::isHdf5 (static) ///\brief This is an overloaded member function, provided for convenience. /// It takes an \c H5std_string for \a name. (Static) ///\param name - IN: Name of the file - \c H5std_string @@ -274,19 +274,6 @@ void H5File::reOpen() } //-------------------------------------------------------------------------- -// Function: H5File::reopen -// Purpose: Reopens this file. -// Exception H5::FileIException -// Description -// This function is replaced by the above function reOpen. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void H5File::reopen() -{ - H5File::reOpen(); -} - -//-------------------------------------------------------------------------- // Function: H5File::getCreatePlist ///\brief Returns the creation property list of this file ///\return FileCreatPropList object @@ -537,6 +524,19 @@ hid_t H5File::getId() const #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- +// Function: H5File::reopen +// Purpose: Reopens this file. +// Exception H5::FileIException +// Description +// This function is replaced by the above function reOpen. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void H5File::reopen() +{ + H5File::reOpen(); +} + +//-------------------------------------------------------------------------- // Function: H5File::p_setId (protected) ///\brief Sets the identifier of this object to a new value. /// diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 830dda0..5fdbcdc 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -21,6 +21,11 @@ namespace H5 { #endif +/*! \class H5File + \brief Class H5File represents an HDF5 file. + + It inherits from H5Location and CommonFG. +*/ class H5_DLLCPP H5File : public H5Location, public CommonFG { public: // Creates or opens an HDF5 file. @@ -94,6 +99,12 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // H5File destructor. virtual ~H5File(); + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Sets the HDF5 file id. + virtual void p_setId(const hid_t new_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS + private: hid_t id; // HDF5 file id @@ -101,13 +112,6 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG { // constructors taking a string or a char* void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ); - protected: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Sets the HDF5 file id. - virtual void p_setId(const hid_t new_id); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index 06148d6..06a5450 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -21,6 +21,7 @@ namespace H5 { #endif +//! Class FloatType operates on HDF5 floating point datatype. class H5_DLLCPP FloatType : public AtomType { public: // Creates a floating-point type using a predefined type diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 6299ea3..5d5b124 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -90,7 +90,7 @@ Group::Group(const hid_t existing_id) : H5Object() //-------------------------------------------------------------------------- // Function: Group overload constructor - dereference ///\brief Given a reference, ref, to an hdf5 group, creates a Group object -///\param obj - IN: Specifying location referenced object is in +///\param loc - IN: Specifying location referenced object is in ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\exception H5::ReferenceException @@ -101,8 +101,6 @@ Group::Group(const hid_t existing_id) : H5Object() //-------------------------------------------------------------------------- Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { - /* H5Location::dereference(loc, ref, ref_type, plist); - */ id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -118,14 +116,6 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(0) { id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); -/* - try { - id = p_dereference(attr.getId(), ref, ref_type, plist); - } catch (ReferenceException deref_error) { - throw ReferenceException("Group constructor - located by an Attribute", - deref_error.getDetailMsg()); - } -*/ } //-------------------------------------------------------------------------- diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index a5e324c..78f5f17 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -21,6 +21,11 @@ namespace H5 { #endif +/*! \class Group + \brief Class Group represents an HDF5 group. + + It inherits many operations from H5Location and CommonFG. +*/ class H5_DLLCPP Group : public H5Object, public CommonFG { public: // Close this group. @@ -56,14 +61,14 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Creates a copy of an existing group using its id. Group( const hid_t group_id ); - private: - hid_t id; // HDF5 group id - protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS // Sets the group id. virtual void p_setId(const hid_t new_id); #endif // DOXYGEN_SHOULD_SKIP_THIS + + private: + hid_t id; // HDF5 group id }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 5a61947..ca9352d 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -17,13 +17,18 @@ #ifndef __IdComponent_H #define __IdComponent_H -// IdComponent represents an HDF5 object that has an identifier. - #ifndef H5_NO_NAMESPACE namespace H5 { #endif class DataSpace; +/*! \class IdComponent + \brief Class IdComponent provides wrappers of the C functions that + operate on an HDF5 identifier. + + In most cases, the C library handles these operations and an application + rarely needs them. +*/ class H5_DLLCPP IdComponent { public: // Increment reference counter. @@ -76,11 +81,10 @@ class H5_DLLCPP IdComponent { virtual ~IdComponent(); protected: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Default constructor. IdComponent(); +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Gets the name of the file, in which an HDF5 object belongs. H5std_string p_get_file_name() const; diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 02efb64..95fa642 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -21,6 +21,7 @@ namespace H5 { #endif +//! Class IntType operates on HDF5 integer datatype. class H5_DLLCPP IntType : public AtomType { public: // Creates a integer type using a predefined type diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index c92a943..e5365f9 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -29,6 +29,12 @@ namespace H5 { // calling H5close #endif // DOXYGEN_SHOULD_SKIP_THIS +/*! \class H5Library + \brief Class H5Library operates the HDF5 library globably. + + It is not neccessary to construct an instance of H5Library to use the + methods. +*/ class H5_DLLCPP H5Library { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 22db85c..b413a17 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -565,9 +565,9 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty ///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. - this is the default +/// reference. (default) ///\exception H5::ReferenceException -///\notes This method is more suitable for a dataset region reference. +///\note This method is more suitable for a dataset region reference. // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const @@ -591,9 +591,9 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa ///\param ref_type - IN: Type of reference to query, valid values are: /// \li \c H5R_OBJECT - Reference is an object reference. /// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. - this is the default +/// reference. (default) ///\exception H5::ReferenceException -///\notes This method is more suitable for a dataset region reference. +///\note This method is more suitable for a dataset region reference. // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const @@ -614,10 +614,10 @@ void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& ///\param ref - IN: Reference pointer ///\param name - IN: Name of the object to be referenced ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_OBJECT - Reference is an object reference (default) /// \li \c H5R_DATASET_REGION - Reference is a dataset region ///\exception H5::ReferenceException -///\notes This method is more suitable for an object reference. +///\note This method is more suitable for an object reference. // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const @@ -638,9 +638,9 @@ void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) con ///\param ref - IN: Reference pointer ///\param name - IN: Name of the object to be referenced - \c H5std_string ///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. +/// \li \c H5R_OBJECT - Reference is an object reference (default) /// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\notes This method is more suitable for an object reference. +///\note This method is more suitable for an object reference. // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const @@ -684,7 +684,7 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty //-------------------------------------------------------------------------- // Function: H5Location::dereference ///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. -///\param obj - IN: Object specifying the location of the referenced object +///\param loc - IN: Location of the referenced object ///\param ref - IN: Reference pointer ///\param ref_type - IN: Reference type ///\exception H5::ReferenceException diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 4ea13cd..bbe86fc 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -19,10 +19,6 @@ #include "H5Classes.h" // constains forward class declarations -// H5Location is an abstract class. It provides a collection of wrappers -// of C functions which take location IDs. Most of these were in H5Object -// but are now moved here for H5File's access. - #ifndef H5_NO_NAMESPACE namespace H5 { #endif @@ -34,15 +30,23 @@ typedef void (*attr_operator_t)( H5Location& loc/*in*/, const H5std_string attr_name/*in*/, void *operator_data/*in,out*/); -class UserData4Aiterate { // user data for attribute iteration +//! User data for attribute iteration +class UserData4Aiterate { public: attr_operator_t op; void* opData; H5Location* location; }; -// An H5Location can be a file, group, dataset, or committed datatype. +/*! \class H5Location + \brief H5Location is an abstract base class, added in version 1.8.12. + It provides a collection of wrappers for the C functions that take a + location identifier to specify the HDF5 object. The location identifier + can be either file, group, dataset, or named datatype. +*/ +// Most of these methods were in H5Object but are now moved here because +// a location can be a file, group, dataset, or named datatype. -BMR, 2013-10-1 class H5_DLLCPP H5Location : public IdComponent { public: // Creates an attribute for the specified object at this location @@ -112,7 +116,7 @@ class H5_DLLCPP H5Location : public IdComponent { void reference(void* ref, const char* name, H5R_type_t ref_type = H5R_OBJECT) const; void reference(void* ref, const H5std_string& name, - H5R_type_t ref_type = H5R_DATASET_REGION) const; + H5R_type_t ref_type = H5R_OBJECT) const; void reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; void reference(void* ref, const H5std_string& name, const DataSpace& dataspace, @@ -130,8 +134,7 @@ class H5_DLLCPP H5Location : public IdComponent { virtual hid_t getId() const = 0; protected: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Default constructor, + // Default constructor H5Location(); // Creates a copy of an existing object giving the location id. @@ -140,6 +143,7 @@ class H5_DLLCPP H5Location : public IdComponent { // Copy constructor. H5Location(const H5Location& original); +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Creates a reference to an HDF5 object or a dataset region. void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const; @@ -154,11 +158,11 @@ class H5_DLLCPP H5Location : public IdComponent { // Retrieves the type of object that an object reference points to. H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; +#endif // DOXYGEN_SHOULD_SKIP_THIS + // Noop destructor. virtual ~H5Location(); -#endif // DOXYGEN_SHOULD_SKIP_THIS - }; /* end class H5Location */ #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 3f9c343..5c2ef98 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -38,6 +38,12 @@ namespace H5 { #endif +/*! \class H5Object + \brief Class H5Object is a bridge between H5Location and DataSet, DataType, + and Group. + + All the wrappers in H5Object were moved to H5Location. +*/ class H5_DLLCPP H5Object : public H5Location { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index 27cfd3a..6dbee98 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -272,22 +272,12 @@ PredType& PredType::operator=( const PredType& rhs ) #ifndef DOXYGEN_SHOULD_SKIP_THIS // These dummy functions do not inherit from DataType - they'll // throw an DataTypeIException if invoked. -void PredType::commit( H5File& loc, const char* name ) +void PredType::commit(H5Location& loc, const char* name ) { throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!" ); } -void PredType::commit( H5File& loc, const H5std_string& name ) -{ - commit( loc, name.c_str()); -} - -void PredType::commit( H5Object& loc, const char* name ) -{ - throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!" ); -} - -void PredType::commit( H5Object& loc, const H5std_string& name ) +void PredType::commit(H5Location& loc, const H5std_string& name ) { commit( loc, name.c_str()); } diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 65e1c07..a8ec0b8 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -14,11 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// PredType holds the definition of all the HDF5 predefined datatypes. -// These types can only be made copy of, not created by H5Tcreate or -// closed by H5Tclose. They are treated as constants. -///////////////////////////////////////////////////////////////////// - #ifndef __H5PredType_H #define __H5PredType_H @@ -36,6 +31,13 @@ namespace H5 { #define H5CPP_EXITED -3 // -3 is less likely to be used elsewhere #endif // DOXYGEN_SHOULD_SKIP_THIS +/*! \class PredType + \brief Class PredType holds the definition of all the HDF5 predefined + datatypes. + + These types can only be made copy of, not created by H5Tcreate or + closed by H5Tclose. They are treated as constants. +*/ class H5_DLLCPP PredType : public AtomType { public: ///\brief Returns this class name. @@ -228,21 +230,18 @@ class H5_DLLCPP PredType : public AtomType { static const PredType NATIVE_UINT_FAST64; #endif /* H5_SIZEOF_UINT_FAST64_T */ -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // These dummy functions do not inherit from DataType - they'll - // throw a DataTypeIException if invoked. - void commit( H5File& loc, const H5std_string& name ); - void commit( H5File& loc, const char* name ); - void commit( H5Object& loc, const H5std_string& name ); - void commit( H5Object& loc, const char* name ); - bool committed(); -#endif // DOXYGEN_SHOULD_SKIP_THIS - - private: - // Added this to work around the atexit/global destructor problem. - // It'll help to terminate the library after other PredType instances - // are closed. -BMR, Mar 30, 2012 - static const PredType AtExit; + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + void commit(H5Location& loc, const H5std_string& name ); + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + void commit(H5Location& loc, const char* name ); + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + bool committed(); protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -254,6 +253,12 @@ class H5_DLLCPP PredType : public AtomType { #endif // DOXYGEN_SHOULD_SKIP_THIS + private: + // Added this to work around the atexit/global destructor problem. + // It'll help to terminate the library after other PredType instances + // are closed. -BMR, Mar 30, 2012 + static const PredType AtExit; + }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index b2c50d4..f26201d 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -21,6 +21,7 @@ namespace H5 { #endif +//! Class PropList provides operations for generic property lists. class H5_DLLCPP PropList : public IdComponent { public: // Default property list diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index 251b0b8..8b3a773 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -21,6 +21,7 @@ namespace H5 { #endif +//! Class StrType operates on HDF5 string datatypes. class H5_DLLCPP StrType : public AtomType { public: // Creates a string type using a predefined type diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h index caa347a..40c597f 100644 --- a/c++/src/H5VarLenType.h +++ b/c++/src/H5VarLenType.h @@ -14,9 +14,6 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// Class VarLenType inherits from DataType and provides wrappers for -// the HDF5 C's Variable-length Datatypes. - #ifndef __H5VarLenType_H #define __H5VarLenType_H @@ -24,6 +21,7 @@ namespace H5 { #endif +//! VarLenType operates on the HDF5 C's Variable-length Datatypes. class H5_DLLCPP VarLenType : public DataType { public: // Constructor that creates a variable-length datatype based diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 4cb0ac1..78ea36f 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -469,7 +469,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 = 155 +LT_VERS_REVISION = 157 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 65b8e57..965065a 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -108,16 +108,10 @@ static void test_file_create() // Create file FILE1 file1 = new H5File (FILE1, H5F_ACC_EXCL); - // try to create the same file with H5F_ACC_TRUNC. This should fail - // because file1 is the same file and is currently open. - -/* These three are failing with new/PGI compiler, HDFFV-8067 - The line "H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E" - Results in this message: - "terminate called without an active exception - Command terminated by signal 6" - Commenting it out until it's fixed LK 20120626. -*/ + // Try to create the same file with H5F_ACC_TRUNC. This should fail + // because file1 is the same file and is currently open. Skip it on + // OpenVMS because it creates another version of the file. +#ifndef H5_HAVE_FILE_VERSIONS try { H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E @@ -126,6 +120,7 @@ static void test_file_create() } catch( FileIException E ) // catch truncating existing file {} // do nothing, FAIL expected +#endif // H5_HAVE_FILE_VERSIONS // Close file1 delete file1; @@ -141,11 +136,14 @@ static void test_file_create() } catch( FileIException E ) // catching creating existing file {} // do nothing, FAIL expected + // Test create with H5F_ACC_TRUNC. This will truncate the existing file. file1 = new H5File (FILE1, H5F_ACC_TRUNC); - // Try to truncate first file again. This should fail because file1 - // is the same file and is currently open. + // Try to create first file again. This should fail because file1 + // is the same file and is currently open. Skip it on OpenVMS because + // it creates another version of the file. +#ifndef H5_HAVE_FILE_VERSIONS try { H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E @@ -156,7 +154,7 @@ static void test_file_create() {} // do nothing, FAIL expected // Try with H5F_ACC_EXCL. This should fail too because the file already - // exists. + // exists. Skip it on OpenVMS because it creates another version of the file. try { H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E @@ -165,6 +163,7 @@ static void test_file_create() } catch( FileIException E ) // catching H5F_ACC_EXCL on existing file {} // do nothing, FAIL expected +#endif /*H5_HAVE_FILE_VERSIONS*/ // Get the file-creation template FileCreatPropList tmpl1 = file1->getCreatePlist(); @@ -387,7 +386,7 @@ static void test_file_size() // Check if it's reasonable. It's 0 now. if (free_space < 0 || free_space > 4*KB) - issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value"); + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value"); PASSED(); } // end of try block @@ -433,54 +432,54 @@ typedef struct s1_t { static void test_file_name() { - // Output message about test being performed + // Output message about test being performed. SUBTEST("File Name"); H5std_string file_name; try { - // Create a file using default properties + // Create a file using default properties. H5File file4(FILE4, H5F_ACC_TRUNC); - // Get file name from the file instance + // Get file name from the file instance. file_name = file4.getFileName(); verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__); - // Create a group in the root group + // Create a group in the root group. Group group(file4.createGroup(GROUPNAME, 0)); - // Get and verify file name via a group + // Get and verify file name via a group. file_name = group.getFileName(); verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__); - // Create the data space + // Create the data space. hsize_t dims[RANK] = {NX, NY}; DataSpace space(RANK, dims); - // Create a new dataset + // Create a new dataset. DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); - // Get and verify file name via a dataset + // Get and verify file name via a dataset. file_name = dataset.getFileName(); verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); - // Create an attribute for the dataset + // Create an attribute for the dataset. Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); - // Get and verify file name + // Get and verify file name via an attribute. file_name = attr.getFileName(); verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); - // Create a compound datatype + // Create a compound datatype. CompType comp_type (sizeof(s1_t)); - // Insert fields + // Insert fields. comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT); comp_type.insertMember("b", HOFFSET(s1_t, b), PredType::NATIVE_FLOAT); - // Save it on file + // Save it on file. comp_type.commit(file4, DTYPENAME); - // Get and verify file name + // Get and verify file name via a committed datatype. comp_type.getFileName(); verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__); PASSED(); diff --git a/config/lt_vers.am b/config/lt_vers.am index 0f47d62..1037868 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 = 155 +LT_VERS_REVISION = 157 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index cebaf0a..ffc27c9 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.165-swmr_chksum0. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.167-swmr_chksum0. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.165-swmr_chksum0' -PACKAGE_STRING='HDF5 1.9.165-swmr_chksum0' +PACKAGE_VERSION='1.9.167-swmr_chksum0' +PACKAGE_STRING='HDF5 1.9.167-swmr_chksum0' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1492,7 +1492,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.165-swmr_chksum0 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.167-swmr_chksum0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1562,7 +1562,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.165-swmr_chksum0:";; + short | recursive ) echo "Configuration of HDF5 1.9.167-swmr_chksum0:";; esac cat <<\_ACEOF @@ -1761,7 +1761,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.165-swmr_chksum0 +HDF5 configure 1.9.167-swmr_chksum0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2855,7 +2855,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.165-swmr_chksum0, which was +It was created by HDF5 $as_me 1.9.167-swmr_chksum0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3687,7 +3687,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.165-swmr_chksum0' + VERSION='1.9.167-swmr_chksum0' cat >>confdefs.h <<_ACEOF @@ -31676,7 +31676,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.165-swmr_chksum0 +HDF5 config.lt 1.9.167-swmr_chksum0 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33814,7 +33814,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.165-swmr_chksum0, which was +This file was extended by HDF5 $as_me 1.9.167-swmr_chksum0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33880,7 +33880,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.165-swmr_chksum0 +HDF5 config.status 1.9.167-swmr_chksum0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index daaabbb..8257e35 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.165-swmr_chksum0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.167-swmr_chksum0], [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 d2cb3e0..bb25a03 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -520,7 +520,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 = 155 +LT_VERS_REVISION = 157 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 39daa9a..850339c 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -460,7 +460,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 = 155 +LT_VERS_REVISION = 157 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 577c524..89ed0ff 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -476,7 +476,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 = 155 +LT_VERS_REVISION = 157 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/H5LTanalyze.c b/hl/src/H5LTanalyze.c index f02bed6..c3e5d73 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -14,9 +14,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * This file was generated by Lex with the command "lex -PH5LTyy -oH5LTanalyze.c H5LTanalyze.l". - * Do NOT modify it by hand, but in line 52, "#ifdef H5_HAVE_UNISTD_H" should be added if - * the platform doesn't have the unistd.h header file. + * This file was generated by Lex with the command "lex -PH5LTyy + * -oH5LTanalyze.c H5LTanalyze.l". Do NOT modify it by hand, but in + * line 52, "#ifdef H5_HAVE_UNISTD_H" should be added if the platform + * doesn't have the unistd.h header file. Also hdf5.h should be added + * before adding H5_HAVE_UNISTD_H. */ #define yy_create_buffer H5LTyy_create_buffer @@ -49,6 +51,7 @@ #define YY_FLEX_MINOR_VERSION 5 #include +#include #ifdef H5_HAVE_UNISTD_H #include #endif diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index ff4347a..92b041a 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -371,7 +371,7 @@ herr_t H5PTclose( hid_t table_id ) htbl_t * table; /* Remove the ID from the library */ - if((table = H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL) + if((table = (htbl_t *)H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL) goto out; /* If the library found the table, remove it */ diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 650519b..1c5c5ab 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -459,7 +459,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 = 155 +LT_VERS_REVISION = 157 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 80a13f7..5811bec 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -48,7 +48,7 @@ Notes: This short set of instructions is written for users who want to cpack -C Release CPackConfig.cmake 6. Install with this command: - HDF5-1.8.11-win32.exe + HDF5-1.8.12-win32.exe B. Linux Quick Step Building HDF5 Libraries with CMake Using GCC @@ -76,7 +76,7 @@ Notes: This short set of instructions is written for users who want to cpack -C Release CPackConfig.cmake 6. Install with this command: - HDF5-1.8.11-Linux.sh + HDF5-1.8.12-Linux.sh @@ -120,13 +120,20 @@ II. Preconditions 4. Windows developers should install NSIS to create an install image with CPack. Visual Studio Express users will not be able to package HDF5 into an install image executable. + + 5. Developers should copy the config/cmake/cacheinit.cmake file and alter the + the settings for the developers' environment. Then the only options needed + on the command line are those options that are different. Example using HDF + default cache file: + cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 10" \ + -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF .. Notes: More information about using CMake can be found at the KitWare site, www.cmake.org. CMake uses the command line; however, the visual CMake tool is - recommended for the configuration step. The steps are similar for + available for the configuration step. The steps are similar for all the operating systems supported by CMake. NOTES: @@ -147,7 +154,8 @@ Notes: More information about using CMake can be found at the KitWare site, www.hdfgroup.org/CDash/HowToSubmit. 4. See the appendix at the bottom of this file for examples of using - a ctest script for building and testing. + a ctest script for building and testing. Using a ctest script is + preferred because of its flexibility. @@ -170,7 +178,7 @@ These five steps are described in detail below. 1. Run CMake - The CMake executable is named "cmake-gui.exe" on Windows and should be + The visual CMake executable is named "cmake-gui.exe" on Windows and should be available in your Start menu. For Linux, UNIX, and Mac users the executable is named "cmake-gui" and can be found where CMake was installed. @@ -183,7 +191,7 @@ These five steps are described in detail below. then use c:\MyHDFstuff\hdf5\build or c:\MyHDFstuff\build\hdf5 as the build directory. - OPTIONAL: + PREFERRED: Users can perform the configuration step without using the visual cmake-gui program. We use the file cacheinit.cmake in the config/cmake folder for our testing. This file enables all the @@ -261,7 +269,7 @@ These five steps are described in detail below. 2. Configure the cache settings - 2.1 Click the Configure button. If this is the first time you are + 2.1 Visual CMake users, click the Configure button. If this is the first time you are running cmake-gui in this directory, you will be prompted for the generator you wish to use (for example on Windows, Visual Studio 9 2008). CMake will read in the CMakeLists.txt files from the source directory and @@ -279,9 +287,9 @@ These five steps are described in detail below. On linux, if you are using the Unix Makefiles generator, the Makefiles will be created in the build folder. - 2.2 Alternative command line example on Windows in c:\MyHDFstuff\hdf5\build directory: + 2.2 Preferred command line example on Windows in c:\MyHDFstuff\hdf5\build directory: - cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 9 2008" \ + cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 10" \ -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF .. 2.3 On Windows, if you are using a Visual Studio Express version you must @@ -293,7 +301,8 @@ These five steps are described in detail below. 3. Build HDF5 On Windows, you can build HDF5 using either the Visual Studio Environment - or the command line. The command line is used on linux, Unix, and Mac. + or the command line. The command line can be used on all platforms; + Windows, linux, Unix, and Mac. To build from the command line, navigate to your build directory and execute the following: @@ -478,8 +487,15 @@ The example is for a linux machine, but the same scripts can be used on a Windows machine by adjusting the CTEST_CMAKE_GENERATOR option in the product specific script. -CTestScript.cmake +NOTE: these files are available at the HDF web site: + http://www.hdfgroup.org/HDF5/release/cmakebuild.html + CTestScript.cmake + SZip.tar.gz + ZLib.tar.gz + + HDF518WindowsRWDICMake.cmake + HDF518LinuxRWDICMake.cmake ======================================================================== @@ -702,42 +718,42 @@ message("Dashboard script configuration:\n${vars}\n") #----------------------------------------------------------------------------- ## NORMAL process -## -- LOCAL_SKIP_UPDATE skips updating the source folder from svn -## -- LOCAL_NO_SUBMIT skips reporting to CDash server +## -- LOCAL_UPDATE updates the source folder from svn +## -- LOCAL_SUBMIT reports to CDash server ## -- LOCAL_SKIP_TEST skips the test process (only builds) ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing ## -- LOCAL_COVERAGE_TEST executes code coverage process ## -------------------------- CTEST_START (${MODEL} TRACK ${MODEL}) -if(NOT LOCAL_SKIP_UPDATE) +if(LOCAL_UPDATE) CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}") -endif(NOT LOCAL_SKIP_UPDATE) +endif(LOCAL_UPDATE) CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}") CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}") -if(NOT LOCAL_NO_SUBMIT) +if(LOCAL_SUBMIT) CTEST_SUBMIT (PARTS Update Configure Notes) -endif(NOT LOCAL_NO_SUBMIT) +endif(LOCAL_SUBMIT) CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) -if(NOT LOCAL_NO_SUBMIT) +if(LOCAL_SUBMIT) CTEST_SUBMIT (PARTS Build) -endif(NOT LOCAL_NO_SUBMIT) +endif(LOCAL_SUBMIT) if(NOT LOCAL_SKIP_TEST) if(NOT LOCAL_MEMCHECK_TEST) CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) - if(NOT LOCAL_NO_SUBMIT) + if(LOCAL_SUBMIT) CTEST_SUBMIT (PARTS Test) - endif(NOT LOCAL_NO_SUBMIT) + endif(LOCAL_SUBMIT) else(NOT LOCAL_MEMCHECK_TEST) CTEST_MEMCHECK (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) - if(NOT LOCAL_NO_SUBMIT) + if(LOCAL_SUBMIT) CTEST_SUBMIT (PARTS MemCheck) - endif(NOT LOCAL_NO_SUBMIT) + endif(LOCAL_SUBMIT) endif(NOT LOCAL_MEMCHECK_TEST) if(LOCAL_COVERAGE_TEST) CTEST_COVERAGE (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) - if(NOT LOCAL_NO_SUBMIT) + if(LOCAL_SUBMIT) CTEST_SUBMIT (PARTS Coverage) - endif(NOT LOCAL_NO_SUBMIT) + endif(LOCAL_SUBMIT) endif(LOCAL_COVERAGE_TEST) endif(NOT LOCAL_SKIP_TEST) if(NOT LOCAL_MEMCHECK_TEST) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index e48287f..c7a50e0 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.165-swmr_chksum0 currently under development +HDF5 version 1.9.167-swmr_chksum0 currently under development INTRODUCTION @@ -1182,9 +1182,9 @@ Supported Platforms Visual Studio 2012 w/ Intel Fortran 13 (cmake) Cygwin(CYGWIN_NT-6.1 1.7.25(0.270/5/3) gcc(4.8.1) compiler and gfortran) (cmake and autotools) - Windows 8 Visual Studio 2012 w/ Intel Fortran 13 (cmake) + Windows 8.1 Visual Studio 2012 w/ Intel Fortran 13 (cmake) - Windows 8 x64 Visual Studio 2012 w/ Intel Fortran 13 (cmake) + Windows 8.1 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 @@ -1291,32 +1291,32 @@ The following platforms are not supported but have been tested for this release. GNU Fortran (Debian 4.7.2-5) 4.7.2 (cmake and autotools) - Fedora19 3.9.9-301.fc19.i6866 #1 SMP i686 i686 i386 GNU/Linux + Fedora19 3.11.1-200.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) - Fedora19 3.9.9-301.fc19.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux + Fedora19 3.11.1-200.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.3 3.7.10-1.1-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux + SUSE 12.3 3.7.10-1.16-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux gcc (SUSE Linux) 4.7.2 GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) - SUSE 12.3 3.7.10-1.1-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux + SUSE 12.3 3.7.10-1.16-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux gcc (SUSE Linux) 4.7.2 GNU Fortran (SUSE Linux) 4.7.2 (cmake and autotools) - Ubuntu 13.04 3.8.0-26-generic #38-Ubuntu SMP i686 GNU/Linux + Ubuntu 13.04 3.8.0-30-generic #44-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 13.04 3.8.0-26-generic #38-Ubuntu SMP x86_64 GNU/Linux + Ubuntu 13.04 3.8.0-30-generic #44-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) @@ -1329,6 +1329,13 @@ The following platforms are not supported but have been tested for this release. Known Problems ============== +* CLANG compiler with the options -fcatch-undefined-behavior and -ftrapv + catches some undefined behavior in the alignment algorithm of the macro DETECT_I + in H5detect.c (Issue 8147). Since the algorithm is trying to detect the alignment + of integers, ideally the flag -fcatch-undefined-behavior shouldn't to be used for + H5detect.c. In the future, we can separate flags for H5detect.c from the rest of + the library. (SLU - 2013/10/16) + * The 5.9 C++ compiler on Sun failed to compile a C++ test ttypes.cpp. It complains with this message: "/home/hdf5/src/H5Vprivate.h", line 130: Error: __func__ is not defined. diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 3c04f36..313e0f0 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -77,7 +77,7 @@ These steps are described in more detail below. 1. Run CMake - The CMake executable is named "cmake-gui.exe" on Windows and should be + The visual CMake executable is named "cmake-gui.exe" on Windows and should be available in your Start menu. For Linux, UNIX, and Mac users the executable is named "cmake-gui" and can be found where CMake was installed. @@ -87,7 +87,7 @@ These steps are described in more detail below. c:\MyHDFstuff\hdf5, then use c:\MyHDFstuff\hdf5\build or c:\MyHDFstuff\build\hdf5 for the build directory. - OPTIONAL: + PREFERRED: Users can perform the configuration step without using the visual cmake-gui program. The following is an example command line configuration step executed within the build directory: @@ -118,9 +118,9 @@ These steps are described in more detail below. 2. Configure the cache settings - 2.1 Click the Configure button. If this is the first time you are + 2.1 Visual CMake users, click the Configure button. If this is the first time you are running cmake-gui in this directory, you will be prompted for the - generator you wish to use (for example on Windows, Visual Studio 9 2008). + generator you wish to use (for example on Windows, Visual Studio 10). CMake will read in the CMakeLists.txt files from the source directory and display options for the HDF5 project. After the first configure you can adjust the cache settings and/or specify locations of other programs. @@ -138,7 +138,7 @@ These steps are described in more detail below. 2.2 Alternative command line example on Windows in c:\MyHDFstuff\hdf5\build directory: - cmake -G "Visual Studio 9 2008" -DBUILD_TESTING:BOOL=ON -DUSE_SHARED_LIBS:BOOL=ON .. + cmake -G "Visual Studio 10" -DBUILD_TESTING:BOOL=ON -DUSE_SHARED_LIBS:BOOL=ON .. 3. Build HDF5 Applications @@ -219,6 +219,13 @@ is entered on the command line and the build folder is created as a sub-folder. Windows should adjust the forward slash to double backslashes, except for the HDF_DIR environment variable. +NOTE: these files are available at the HDF web site: + http://www.hdfgroup.org/HDF5/release/cmakebuild.html + + CTestScript.cmake + + HDF518ExamplesWindowsbinaryCMake.cmake + ======================================================================== @@ -253,11 +260,6 @@ set(SITE_OS_BITS "os size") set(SITE_COMPILER_NAME "compiler name") set(SITE_COMPILER_VERSION "compiler version") -# skip submit to cdash -set(LOCAL_NO_SUBMIT "True") -# skip update source from repository -set(LOCAL_SKIP_UPDATE "True") - # needed for source updates, change as required set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5-examples/trunk/1_8") diff --git a/src/H5.c b/src/H5.c index 03d82a8..49a0aea 100644 --- a/src/H5.c +++ b/src/H5.c @@ -722,7 +722,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); if(*substr) { - HDstrncat(lib_str, "-", 1); + HDstrncat(lib_str, "-", (size_t)1); HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1); } /* end if */ if (HDstrcmp(lib_str, H5_lib_vers_info_g)){ diff --git a/src/H5A.c b/src/H5A.c index e1aeaac..edac156 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -95,7 +95,6 @@ H5FL_BLK_DEFINE(attr_buf); static const H5I_class_t H5I_ATTR_CLS[1] = {{ H5I_ATTR, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5A_close /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 30048ba..c8d3e27 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -358,8 +358,7 @@ H5_DLL herr_t H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *typ H5_DLL herr_t H5AC_pin_protected_entry(void *thing); H5_DLL herr_t H5AC_create_flush_dependency(void *parent_thing, void *child_thing); H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, - haddr_t addr, void *udata, - H5AC_protect_t rw); + haddr_t addr, void *udata, H5AC_protect_t rw); H5_DLL herr_t H5AC_resize_entry(void *thing, size_t new_size); H5_DLL herr_t H5AC_unpin_entry(void *thing); H5_DLL herr_t H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing); diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 8074c3e..58c0da7 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -196,12 +196,12 @@ H5B2__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Magic number */ if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header signature") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5B2_HDR_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version") + HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree header version") /* B-tree class */ id = (H5B2_subid_t)*p++; @@ -613,7 +613,7 @@ H5B2__cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Magic number */ if(HDmemcmp(p, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree internal node signature") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node signature") p += H5_SIZEOF_MAGIC; /* Version */ diff --git a/src/H5Dint.c b/src/H5Dint.c index ccb6707..cbab788 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -112,7 +112,6 @@ static H5D_shared_t H5D_def_dset; static const H5I_class_t H5I_DATASET_CLS[1] = {{ H5I_DATASET, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5D_close /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5E.c b/src/H5E.c index 72eec51..3fc158c 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -123,7 +123,6 @@ H5FL_DEFINE_STATIC(H5E_msg_t); static const H5I_class_t H5I_ERRCLS_CLS[1] = {{ H5I_ERROR_CLASS, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5E_unregister_class /* Callback routine for closing objects of this class */ }}; @@ -132,7 +131,6 @@ static const H5I_class_t H5I_ERRCLS_CLS[1] = {{ static const H5I_class_t H5I_ERRMSG_CLS[1] = {{ H5I_ERROR_MSG, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5E_close_msg /* Callback routine for closing objects of this class */ }}; @@ -141,7 +139,6 @@ static const H5I_class_t H5I_ERRMSG_CLS[1] = {{ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ H5I_ERROR_STACK, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5E_close_stack /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5F.c b/src/H5F.c index dc4e86f..f7a8240 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -109,7 +109,6 @@ H5FL_DEFINE(H5F_file_t); static const H5I_class_t H5I_FILE_CLS[1] = {{ H5I_FILE, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5F_close /* Callback routine for closing objects of this class */ }}; @@ -670,6 +669,13 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) HDassert(obj_ptr); HDassert(olist); + /* Check if we've filled up the array. Return TRUE only if + * we have filled up the array. Otherwise return FALSE(RET_VALUE is + * preset to FALSE) because H5I_iterate needs the return value of + * FALSE to continue the iteration. */ + if(olist->max_index>0 && olist->list_index>=olist->max_index) + HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ + /* Count file IDs */ if(olist->obj_type == H5I_FILE) { if((olist->file_info.local && @@ -685,13 +691,6 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) /* Increment the number of open objects */ if(olist->obj_id_count) (*olist->obj_id_count)++; - - /* Check if we've filled up the array. Return TRUE only if - * we have filled up the array. Otherwise return FALSE(RET_VALUE is - * preset to FALSE) because H5I_iterate needs the return value of - * FALSE to continue the iteration. */ - if(olist->max_index>0 && olist->list_index>=olist->max_index) - HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ } } /* end if */ else { /* either count opened object IDs or put the IDs on the list */ @@ -750,13 +749,6 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) /* Increment the number of open objects */ if(olist->obj_id_count) (*olist->obj_id_count)++; - - /* Check if we've filled up the array. Return TRUE only if - * we have filled up the array. Otherwise return FALSE(RET_VALUE is - * preset to FALSE) because H5I_iterate needs the return value of - * FALSE to continue iterating. */ - if(olist->max_index>0 && olist->list_index>=olist->max_index) - HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ } /* end if */ } /* end else */ diff --git a/src/H5FD.c b/src/H5FD.c index 49844c5..5f447ec 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -106,7 +106,6 @@ static unsigned long H5FD_file_serial_no_g; static const H5I_class_t H5I_VFL_CLS[1] = {{ H5I_VFL, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5FD_free_cls /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5FS.c b/src/H5FS.c index dde203f..295b347 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -99,7 +99,7 @@ H5FL_DEFINE(H5FS_t); */ H5FS_t * H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr, const H5FS_create_t *fs_create, - size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) + uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { H5FS_t *fspace = NULL; /* New free space structure */ H5FS_t *ret_value; /* Return value */ @@ -181,7 +181,7 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); *------------------------------------------------------------------------- */ H5FS_t * -H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, size_t nclasses, +H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { H5FS_t *fspace = NULL; /* New free space structure */ @@ -572,7 +572,7 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va *------------------------------------------------------------------------- */ H5FS_t * -H5FS_new(const H5F_t *f, size_t nclasses, const H5FS_section_class_t *classes[], +H5FS_new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata) { H5FS_t *fspace = NULL; /* Free space manager */ diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index c1c8c29..44b4ac0 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -143,7 +143,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fspace->ghost_sect_count); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of free space section classes:", - fspace->nclasses); + (unsigned)fspace->nclasses); HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, "Shrink percent:", fspace->shrink_percent); diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index d914e8e..93fa485 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -96,7 +96,7 @@ /* Callback info for loading a free space header into the cache */ typedef struct H5FS_hdr_cache_ud_t { H5F_t *f; /* File that free space header is within */ - size_t nclasses; /* Number of section classes */ + uint16_t nclasses; /* Number of section classes */ const H5FS_section_class_t **classes; /* Array of section class info */ void *cls_init_udata; /* Pointer to class init user data */ haddr_t addr; /* Address of header */ @@ -163,7 +163,7 @@ struct H5FS_t { /* Creation parameters */ H5FS_client_t client; /* Type of user of this free space manager */ - unsigned nclasses; /* Number of section classes handled */ + uint16_t nclasses; /* Number of section classes handled */ unsigned shrink_percent; /* Percent of "normal" serialized size to shrink serialized space at */ unsigned expand_percent; /* Percent of "normal" serialized size to expand serialized space at */ unsigned max_sect_addr; /* Size of address space free sections are within (log2 of actual value) */ @@ -228,7 +228,7 @@ H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); /* Free space manager header routines */ -H5_DLL H5FS_t *H5FS_new(const H5F_t *f, size_t nclasses, +H5_DLL H5FS_t *H5FS_new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata); H5_DLL herr_t H5FS_incr(H5FS_t *fspace); H5_DLL herr_t H5FS_decr(H5FS_t *fspace); diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 48fb6d0..2dacce6 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -174,10 +174,10 @@ H5FL_SEQ_EXTERN(H5FS_section_class_t); /* Free space manager routines */ H5_DLL H5FS_t *H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr, - const H5FS_create_t *fs_create, size_t nclasses, + const H5FS_create_t *fs_create, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold); H5_DLL H5FS_t *H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, - size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold); + uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold); H5_DLL herr_t H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size); H5_DLL herr_t H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr); H5_DLL herr_t H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace); @@ -202,7 +202,7 @@ H5_DLL herr_t H5FS_sect_iterate(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_op H5_DLL herr_t H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects); H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, - H5FS_section_info_t *sect, unsigned new_class); + H5FS_section_info_t *sect, uint16_t new_class); H5_DLL htri_t H5FS_sect_try_shrink_eoa(const H5F_t *f, hid_t dxpl_id, const H5FS_t *fspace, void *op_data); H5_DLL herr_t H5FS_sect_query_last_sect(const H5FS_t *fspace, haddr_t *sect_addr, hsize_t *sect_size); diff --git a/src/H5FSsection.c b/src/H5FSsection.c index faa2b2a..baf7403 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -2023,7 +2023,7 @@ H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects) */ herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, - H5FS_section_info_t *sect, unsigned new_class) + H5FS_section_info_t *sect, uint16_t new_class) { const H5FS_section_class_t *old_cls; /* Old class of section */ const H5FS_section_class_t *new_cls; /* New class of section */ diff --git a/src/H5G.c b/src/H5G.c index 7cf5a91..e16847d 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -134,7 +134,6 @@ static const H5I_class_t H5I_GROUP_CLS[1] = {{ H5I_GROUP, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5Gint.c b/src/H5Gint.c index fe8b995..6f42cc2 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -992,7 +992,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) /* Add the path separator to the current path */ HDassert(udata->path[udata->curr_path_len] == '\0'); - HDstrncpy(&(udata->path[udata->curr_path_len]), "/", 2); + HDstrncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2); udata->curr_path_len++; /* Attempt to get the link info for this group */ diff --git a/src/H5Gname.c b/src/H5Gname.c index 1d2644b..bbeddb6 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -325,7 +325,7 @@ H5G_build_fullpath(const char *prefix, const char *name) /* Build full path */ HDstrncpy(full_path, prefix, orig_path_len + 1); if(need_sep) - HDstrncat(full_path, "/", 1); + HDstrncat(full_path, "/", (size_t)1); HDstrncat(full_path, name, name_len); /* Create reference counted string for path */ @@ -1331,7 +1331,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * /* If there's a buffer provided, copy into it, up to the limit of its size */ if(name) { /* Copy the initial path separator */ - HDstrncpy(name, "/", 2); + HDstrncpy(name, "/", (size_t)2); /* Append the rest of the path */ /* (less one character, for the initial path separator) */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index e602fc1..5979ec2 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -769,7 +769,7 @@ H5_DLL herr_t H5HF_space_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, H5_DLL herr_t H5HF_space_close(H5HF_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5HF_space_delete(H5HF_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5HF_space_sect_change_class(H5HF_hdr_t *hdr, hid_t dxpl_id, - H5HF_free_section_t *sect, unsigned new_class); + H5HF_free_section_t *sect, uint16_t new_class); /* Free space section routines */ H5_DLL H5HF_free_section_t *H5HF_sect_single_new(hsize_t sect_off, diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 01330d3..577d3b8 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -613,7 +613,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_space_sect_change_class(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sect, unsigned new_class) +H5HF_space_sect_change_class(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sect, uint16_t new_class) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HGcache.c b/src/H5HGcache.c index afb2a75..4e3f568 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -184,7 +184,7 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) * assume that it's free space. */ HDassert(NULL == heap->obj[0].begin); - heap->obj[0].size = ((const uint8_t *)heap->chunk + heap->size) - p; + heap->obj[0].size = (size_t)(((const uint8_t *)heap->chunk + heap->size) - p); heap->obj[0].begin = p; p += heap->obj[0].size; } /* end if */ diff --git a/src/H5I.c b/src/H5I.c index 465e607..e4958aa 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -48,6 +48,7 @@ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip Lists */ /* Define this to compile in support for dumping ID information */ /* #define H5I_DEBUG_OUTPUT */ @@ -62,25 +63,6 @@ /* Local Macros */ -/* - * Define the following macro for fast hash calculations (but limited - * hash sizes) - */ -#define HASH_SIZE_POWER_2 - -#ifdef HASH_SIZE_POWER_2 -/* - * Map an ID to a hash location (assumes s is a power of 2 and smaller - * than the ID_MASK constant). - */ -# define H5I_LOC(a,s) ((hid_t)((size_t)(a)&((s)-1))) -#else -/* - * Map an ID to a hash location. - */ -# define H5I_LOC(a,s) (((hid_t)(a)&ID_MASK)%(s)) -#endif - /* Combine a Type number and an atom index into an atom */ #define H5I_MAKE(g,i) ((((hid_t)(g)&TYPE_MASK)<id_list) + if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; } /* end for */ @@ -200,7 +197,7 @@ H5I_term_interface(void) for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) { type_ptr = H5I_id_type_list_g[type]; if(type_ptr) { - HDassert(NULL == type_ptr->id_list); + HDassert(NULL == type_ptr->ids); type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; } /* end if */ @@ -279,7 +276,6 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) /* Initialize class fields */ cls->type_id = new_type; cls->flags = H5I_CLASS_IS_APPLICATION; - cls->hash_size = hash_size; cls->reserved = reserved; cls->free_func = free_func; @@ -330,13 +326,6 @@ H5I_register_type(const H5I_class_t *cls) HDassert(cls->type_id > 0 && cls->type_id < H5I_MAX_NUM_TYPES); /* Initialize the type */ - - /* Check arguments */ -#ifdef HASH_SIZE_POWER_2 - if(!POWER_OF_TWO(cls->hash_size) || cls->hash_size == 1) - HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid hash size") -#endif /* HASH_SIZE_POWER_2 */ - if(NULL == H5I_id_type_list_g[cls->type_id]) { /* Allocate the type information for new type */ if(NULL == (type_ptr = (H5I_id_type_t *)H5FL_CALLOC(H5I_id_type_t))) @@ -349,24 +338,23 @@ H5I_register_type(const H5I_class_t *cls) } /* end else */ /* Initialize the ID type structure for new types */ - if(type_ptr->count == 0) { + if(type_ptr->init_count == 0) { type_ptr->cls = cls; - type_ptr->wrapped = 0; - type_ptr->ids = 0; + type_ptr->wrapped = FALSE; + type_ptr->id_count = 0; type_ptr->nextid = cls->reserved; - type_ptr->id_list = (H5I_id_info_t **)H5MM_calloc(cls->hash_size * sizeof(H5I_id_info_t *)); - if(NULL == type_ptr->id_list) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed") + if(NULL == (type_ptr->ids = H5SL_create(H5SL_TYPE_HID, NULL))) + HGOTO_ERROR(H5E_ATOM, H5E_CANTCREATE, FAIL, "skip list creation failed") } /* end if */ /* Increment the count of the times this type has been initialized */ - type_ptr->count++; + type_ptr->init_count++; done: if(ret_value < 0) { /* Clean up on error */ if(type_ptr) { - if(type_ptr->id_list) - H5MM_xfree(type_ptr->id_list); + if(type_ptr->ids) + H5SL_close(type_ptr->ids); (void)H5FL_FREE(H5I_id_type_t, type_ptr); } /* end if */ } /* end if */ @@ -485,11 +473,11 @@ H5I_nmembers(H5I_type_t type) if(type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->count <= 0) + if(NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) HGOTO_DONE(0); /* Set return value */ - H5_ASSIGN_OVERFLOW(ret_value, type_ptr->ids, unsigned, int); + H5_ASSIGN_OVERFLOW(ret_value, type_ptr->id_count, unsigned, int); done: FUNC_LEAVE_NOAPI(ret_value) @@ -542,32 +530,14 @@ done: * Programmer: Robb Matzke * Wednesday, March 24, 1999 * - * Modifications: - * Robb Matzke, 1999-04-27 - * If FORCE is zero then any item for which the free callback - * failed is not removed. This function returns failure if - * items could not be removed. - * - * Robb Matzke, 1999-08-17 - * If the object reference count is larger than one then it must - * be because the library is using the object internally. This - * happens for instance for file driver ID's which are stored in - * things like property lists, files, etc. Objects that have a - * reference count larger than one are not affected unless FORCE - * is non-zero. - * - * Neil Fortner, 2008-08-08 - * Added app_ref parameter. If app_ref is FALSE, then the - * application reference count is ignored (i.e. subtracted from - * the total reference count) when determining which id's to - * close. *------------------------------------------------------------------------- */ herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) { H5I_id_type_t *type_ptr; /* ptr to the atomic type */ - unsigned i; /* Local index variable */ + H5SL_node_t *curr_node; /* Current skip list node ptr */ + H5SL_node_t *next_node; /* Next skip list node ptr */ int ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -576,7 +546,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->count <= 0) + if(type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* @@ -584,22 +554,21 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) * counts. Ignore the return value from from the free method and remove * object from type regardless if FORCE is non-zero. */ - for(i = 0; i < type_ptr->cls->hash_size; i++) { - H5I_id_info_t *cur; /* Current node being worked with */ - H5I_id_info_t *next; /* Next node in list */ - - for(cur = type_ptr->id_list[i]; cur; cur = next) { - hbool_t delete_node; /* Flag to indicate node should be removed from linked list */ - - /* - * Do nothing to the object if the reference count is larger than - * one and forcing is off. - */ - if(!force && (cur->count - (!app_ref * cur->app_count)) > 1) { - next = cur->next; - continue; - } /* end if */ + for(curr_node = H5SL_first(type_ptr->ids); curr_node; curr_node = next_node) { + H5I_id_info_t *cur; /* Current ID being worked with */ + hbool_t delete_node; /* Flag to indicate node should be removed from linked list */ + /* Get ID for this node */ + if(NULL == (cur = (H5I_id_info_t *)H5SL_item(curr_node))) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID info for node") + + /* + * Do nothing to the object if the reference count is larger than + * one and forcing is off. + */ + if(!force && (cur->count - (!app_ref * cur->app_count)) > 1) + delete_node = FALSE; + else { /* Check for a 'free' function and call it, if it exists */ /* (Casting away const OK -QAK) */ if(type_ptr->cls->free_func && (type_ptr->cls->free_func)((void *)cur->obj_ptr) < 0) { @@ -624,51 +593,23 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) /* Indicate node should be removed from list */ delete_node = TRUE; } /* end else */ + } /* end else */ - /* Check if we should delete this node or not */ - if(delete_node) { - H5I_id_info_t *last; /* Last node seen */ - H5I_id_info_t *tmp; /* Temporary node ptr */ - - /* Decrement the number of IDs in the type */ - (type_ptr->ids)--; - - /* Advance to next node */ - next = cur->next; - - /* Re-scan the list of nodes and remove the node from the list */ - /* (can't maintain static pointers to the previous node in the */ - /* list, because the node's 'free' callback could have */ - /* make an H5I call, which could potentially change the */ - /* order of the nodes on the list - QAK) */ - last = NULL; - tmp = type_ptr->id_list[i]; - while(tmp != cur) { - HDassert(tmp != NULL); - last = tmp; - tmp = tmp->next; - } /* end while */ - - /* Delete the node from the list */ - if(NULL == last) { - /* Node at head of list, just advance the list head to next node */ - HDassert(type_ptr->id_list[i] == cur); - type_ptr->id_list[i] = next; - } /* end if */ - else { - /* Node in middle of list, jump over it */ - HDassert(last->next == cur); - last->next = next; - } /* end else */ + /* Get the next node in the list */ + next_node = H5SL_next(curr_node); - /* Free the node */ - cur = H5FL_FREE(H5I_id_info_t, cur); - } /* end if */ - else { - /* Advance to next node */ - next = cur->next; - } /* end else */ - } /* end for */ + /* Check if we should delete this node or not */ + if(delete_node) { + /* Decrement the number of IDs in the type */ + (type_ptr->id_count)--; + + /* Remove the node from the list */ + if(NULL == H5SL_remove(type_ptr->ids, &cur->id)) + HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't remove ID node from skip list") + + /* Free the node */ + cur = H5FL_FREE(H5I_id_info_t, cur); + } /* end if */ } /* end for */ done: @@ -683,7 +624,7 @@ done: * regardless of their reference counts. Destroying IDs * involves calling the free-func for each ID's object and * then adding the ID struct to the ID free list. Public - * interface to H5I_destroy_type. + * interface to H5I__destroy_type. * * Return: Zero on success/Negative on failure * @@ -703,7 +644,7 @@ H5Idestroy_type(H5I_type_t type) if(H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - ret_value = H5I_destroy_type(type); + ret_value = H5I__destroy_type(type); done: FUNC_LEAVE_API(ret_value) @@ -711,7 +652,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_destroy_type + * Function: H5I__destroy_type * * Purpose: Destroys a type along with all atoms in that type * regardless of their reference counts. Destroying IDs @@ -725,19 +666,19 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5I_destroy_type(H5I_type_t type) +static herr_t +H5I__destroy_type(H5I_type_t type) { H5I_id_type_t *type_ptr; /* ptr to the atomic type */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC if(type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->count <= 0) + if(type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Close/clear/destroy all IDs for this type */ @@ -749,14 +690,16 @@ H5I_destroy_type(H5I_type_t type) if(type_ptr->cls->flags & H5I_CLASS_IS_APPLICATION) type_ptr->cls = H5FL_FREE(H5I_class_t, (void *)type_ptr->cls); - type_ptr->id_list = H5MM_xfree(type_ptr->id_list); + if(H5SL_close(type_ptr->ids) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") + type_ptr->ids = NULL; type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_destroy_type() */ +} /* end H5I__destroy_type() */ /*------------------------------------------------------------------------- @@ -791,6 +734,47 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__wrapped_cb + * + * Purpose: Callback for searching for next free ID, when IDs have wrapped + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, October 3, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5I__wrapped_cb(void *_item, void UNUSED *_key, void *_udata) +{ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_wrap_ud_t *udata = (H5I_wrap_ud_t *)_udata; /* Pointer to user data */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(item); + HDassert(udata); + + /* Break out if we see a free ID */ + if(udata->nextid != item->id) { + /* Sanity check */ + HDassert(item->id > udata->nextid); + + ret_value = H5_ITER_STOP; + } /* end if */ + else + /* Increment to expect the next ID */ + udata->nextid++; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__wrapped_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5I_register * * Purpose: Registers an OBJECT in a TYPE and returns an ID for it. @@ -806,13 +790,6 @@ done: * * Programmer: Unknown * - * Modifications: - * - * Neil Fortner, 7 Aug 2008 - * Added app_ref parameter and support for the app_count field, to - * distiguish between reference count from the library and from the - * application. - * *------------------------------------------------------------------------- */ hid_t @@ -821,10 +798,6 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) H5I_id_type_t *type_ptr; /*ptr to the type */ H5I_id_info_t *id_ptr; /*ptr to the new ID information */ hid_t new_id; /*new ID */ - unsigned hash_loc; /*new item's hash table location*/ - hid_t next_id; /*next ID to check */ - H5I_id_info_t *curr_id; /*ptr to the current atom */ - unsigned i; /*counter */ hid_t ret_value = SUCCEED; /*return value */ FUNC_ENTER_NOAPI(FAIL) @@ -833,7 +806,7 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) if(type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->count <= 0) + if(NULL == type_ptr || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -844,16 +817,11 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) id_ptr->count = 1; /*initial reference count*/ id_ptr->app_count = !!app_ref; id_ptr->obj_ptr = object; - id_ptr->next = NULL; - - /* hash bucket already full, prepend to front of chain */ - hash_loc = type_ptr->nextid % (unsigned)type_ptr->cls->hash_size; - if(type_ptr->id_list[hash_loc] != NULL) - id_ptr->next = type_ptr->id_list[hash_loc]; /* Insert into the type */ - type_ptr->id_list[hash_loc] = id_ptr; - type_ptr->ids++; + if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") + type_ptr->id_count++; type_ptr->nextid++; /* @@ -861,47 +829,33 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) * wrapping around, thus necessitating checking for duplicate IDs being * handed out. */ - if(type_ptr->nextid > (unsigned)ID_MASK) { - type_ptr->wrapped = 1; - type_ptr->nextid = type_ptr->cls->reserved; - } /* end if */ + if(type_ptr->nextid > (unsigned)ID_MASK) + type_ptr->wrapped = TRUE; /* * If we've wrapped around then we need to check for duplicate id's being * handed out. */ if(type_ptr->wrapped) { - /* - * Make sure we check all available ID's. If we're about at the end - * of the range then wrap around and check the beginning values. If - * we check all possible values and didn't find any free ones *then* - * we can fail. - */ - for(i = type_ptr->cls->reserved; i < ID_MASK; i++) { - /* Handle end of range by wrapping to beginning */ - if(type_ptr->nextid > (unsigned)ID_MASK) - type_ptr->nextid = type_ptr->cls->reserved; - - /* new ID to check for */ - next_id = H5I_MAKE(type, type_ptr->nextid); - hash_loc = (unsigned)H5I_LOC(type_ptr->nextid, type_ptr->cls->hash_size); - curr_id = type_ptr->id_list[hash_loc]; - if(curr_id == NULL) - break; /* Ha! this is not likely... */ - - while(curr_id) { - if(curr_id->id == next_id) - break; - curr_id = curr_id->next; - } /* end while */ - if(!curr_id) - break; /* must not have found a match */ - type_ptr->nextid++; - } /* end for */ - - if(i >= (unsigned)ID_MASK) - /* All the IDs are gone! */ + H5I_wrap_ud_t udata; /* User data for iteration */ + herr_t iter_status; /* Iteration status */ + + /* Set up user data for iteration */ + udata.nextid = type_ptr->cls->reserved; + + /* Iterate over all the ID nodes, looking for a gap in the ID sequence */ + if((iter_status = H5SL_iterate(type_ptr->ids, H5I__wrapped_cb, &udata)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "ID iteration failed") + + /* If we didn't break out of the iteration and we're at the max. ID, we've used all the IDs */ + if(0 == iter_status && udata.nextid >= ID_MASK) HGOTO_ERROR(H5E_ATOM, H5E_NOIDS, FAIL, "no IDs available in type") + + /* Sanity check */ + HDassert(udata.nextid < ID_MASK); + + /* Retain the next ID for the class */ + type_ptr->nextid = udata.nextid; } /* end if */ /* Set return value */ @@ -937,7 +891,6 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t { H5I_id_type_t *type_ptr; /*ptr to the type */ H5I_id_info_t *id_ptr; /*ptr to the new ID information */ - unsigned hash_loc; /*new item's hash table location*/ hid_t ret_value = SUCCEED; /*return value */ FUNC_ENTER_NOAPI(FAIL) @@ -945,7 +898,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t /* Check arguments */ /* Make sure ID is not already in use */ - if(NULL != (id_ptr = H5I_find_id(id))) + if(NULL != (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use?!") /* Make sure type number is valid */ @@ -955,7 +908,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t /* Get type pointer from list of types */ type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->count <= 0) + if(NULL == type_ptr || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Make sure requested ID belongs to object's type */ @@ -971,18 +924,11 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id_ptr->count = 1; /*initial reference count*/ id_ptr->app_count = !!app_ref; id_ptr->obj_ptr = object; - id_ptr->next = NULL; - - /* determine hash bucket location to store id */ - hash_loc = id % (unsigned)type_ptr->cls->hash_size; - - /* hash bucket already full, prepend to front of chain */ - if(type_ptr->id_list[hash_loc] != NULL) - id_ptr->next = type_ptr->id_list[hash_loc]; /* Insert into the type */ - type_ptr->id_list[hash_loc] = id_ptr; - type_ptr->ids++; + if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") + type_ptr->id_count++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1012,7 +958,7 @@ H5I_subst(hid_t id, const void *new_object) FUNC_ENTER_NOAPI(NULL) /* General lookup of the ID */ - if(NULL == (id_ptr = H5I_find_id(id))) + if(NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") /* Get the old object pointer to return */ @@ -1049,7 +995,7 @@ H5I_object(hid_t id) FUNC_ENTER_NOAPI(NULL) /* General lookup of the ID */ - if(NULL != (id_ptr = H5I_find_id(id))) { + if(NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ /* (Casting away const OK -QAK) */ ret_value = (void *)id_ptr->obj_ptr; @@ -1123,7 +1069,7 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) HDassert(id_type >= 1 && id_type < H5I_next_type); /* Verify that the type of the ID is correct & lookup the ID */ - if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I_find_id(id))) { + if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ /* (Casting away const OK -QAK) */ ret_value = (void *)id_ptr->obj_ptr; @@ -1205,7 +1151,7 @@ done: * * Purpose: Removes the specified ID from its type, first checking that the * type of the ID and the type type are the same. Public interface to - * H5I_remove_verify. + * H5I__remove_verify. * * Return: Success: A pointer to the object that was removed, the * same pointer which would have been found by @@ -1228,7 +1174,7 @@ H5Iremove_verify(hid_t id, H5I_type_t id_type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Remove the id */ - ret_value = H5I_remove_verify(id, id_type); + ret_value = H5I__remove_verify(id, id_type); done: FUNC_LEAVE_API(ret_value) @@ -1236,7 +1182,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_remove_verify + * Function: H5I__remove_verify * * Purpose: Removes the specified ID from its type, first checking that * the ID's type is the same as the ID type supplied as an argument @@ -1252,11 +1198,11 @@ done: *------------------------------------------------------------------------- */ void * -H5I_remove_verify(hid_t id, H5I_type_t id_type) +H5I__remove_verify(hid_t id, H5I_type_t id_type) { void * ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC_NOERR /* Argument checking will be performed by H5I_remove() */ @@ -1264,10 +1210,50 @@ H5I_remove_verify(hid_t id, H5I_type_t id_type) if(id_type == H5I_TYPE(id)) ret_value = H5I_remove(id); -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_remove_verify() */ +} /* end H5I__remove_verify() */ + + +/*------------------------------------------------------------------------- + * Function: H5I__remove_common + * + * Purpose: Common code to remove a specified ID from its type. + * + * Return: Success: A pointer to the object that was removed, the + * same pointer which would have been found by + * calling H5I_object(). + * Failure: NULL + * + * Programmer: Quincey Koziol + * October 3, 2013 + * + *------------------------------------------------------------------------- + */ +static void * +H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) +{ + H5I_id_info_t *curr_id; /*ptr to the current atom */ + void * ret_value; /*return value */ + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(type_ptr); + + /* Get the ID node for the ID */ + if(NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) + HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") + + /* (Casting away const OK -QAK) */ + ret_value = (void *)curr_id->obj_ptr; + curr_id = H5FL_FREE(H5I_id_info_t, curr_id); + + /* Decrement the number of IDs in the type */ + (type_ptr->id_count)--; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__remove_common() */ /*------------------------------------------------------------------------- @@ -1288,11 +1274,8 @@ void * H5I_remove(hid_t id) { H5I_id_type_t *type_ptr; /*ptr to the atomic type */ - H5I_id_info_t *curr_id; /*ptr to the current atom */ - H5I_id_info_t *last_id; /*ptr to the last atom */ H5I_type_t type; /*atom's atomic type */ - unsigned hash_loc; /*atom's hash table location */ - void * ret_value = NULL; /*return value */ + void * ret_value; /*return value */ FUNC_ENTER_NOAPI(NULL) @@ -1301,40 +1284,12 @@ H5I_remove(hid_t id) if(type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->count <= 0) + if(type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") - /* Get the bucket in which the ID is located */ - hash_loc = (unsigned)H5I_LOC(id, type_ptr->cls->hash_size); - curr_id = type_ptr->id_list[hash_loc]; - if(NULL == curr_id) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID") - - last_id = NULL; - while(curr_id != NULL) { - if(curr_id->id == id) - break; - last_id = curr_id; - curr_id = curr_id->next; - } /* end while */ - - if(curr_id != NULL) { - if(last_id == NULL) { - /* ID is the first in the chain */ - type_ptr->id_list[hash_loc] = curr_id->next; - } else { - last_id->next = curr_id->next; - } - /* (Casting away const OK -QAK) */ - ret_value = (void *)curr_id->obj_ptr; - curr_id = H5FL_FREE(H5I_id_info_t, curr_id); - } else { - /* couldn't find the ID in the proper place */ - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID") - } - - /* Decrement the number of IDs in the type */ - (type_ptr->ids)--; + /* Remove the node from the type */ + if(NULL == (ret_value = H5I__remove_common(type_ptr, id))) + HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1412,11 +1367,11 @@ H5I_dec_ref(hid_t id) if(type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->count <= 0) + if(NULL == type_ptr || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") /* General lookup of the ID */ - if(NULL == (id_ptr = H5I_find_id(id))) + if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* @@ -1437,7 +1392,9 @@ H5I_dec_ref(hid_t id) if(1 == id_ptr->count) { /* (Casting away const OK -QAK) */ if(!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) { - H5I_remove(id); + /* Remove the node from the type */ + if(NULL == H5I__remove_common(type_ptr, id)) + HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't remove ID node") ret_value = 0; } /* end if */ else @@ -1485,7 +1442,7 @@ H5I_dec_app_ref(hid_t id) /* Check if the ID still exists */ if(ret_value > 0) { /* General lookup of the ID */ - if(NULL == (id_ptr = H5I_find_id(id))) + if(NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Adjust app_ref */ @@ -1591,13 +1548,6 @@ done: * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * - * Neil Fortner, 7 Aug 2008 - * Added app_ref parameter and support for the app_count field, to - * distiguish between reference count from the library and from the - * application. - * *------------------------------------------------------------------------- */ int @@ -1618,11 +1568,11 @@ H5I_inc_ref(hid_t id, hbool_t app_ref) if(type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->count <= 0) + if(!type_ptr || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* General lookup of the ID */ - if(NULL == (id_ptr = H5I_find_id(id))) + if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Adjust reference counts */ @@ -1683,13 +1633,6 @@ done: * Programmer: Quincey Koziol * Saturday, Decemeber 6, 2003 * - * Modifications: - * - * Neil Fortner, 7 Aug 2008 - * Added app_ref parameter and support for the app_count field, to - * distiguish between reference count from the library and from the - * application. - * *------------------------------------------------------------------------- */ int @@ -1710,11 +1653,11 @@ H5I_get_ref(hid_t id, hbool_t app_ref) if(type <= H5I_BADID || type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->count <= 0) + if(!type_ptr || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* General lookup of the ID */ - if(NULL == (id_ptr = H5I_find_id(id))) + if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Set return value */ @@ -1755,7 +1698,7 @@ H5Iinc_type_ref(H5I_type_t type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual increment operation */ - if((ret_value = H5I_inc_type_ref(type)) < 0) + if((ret_value = H5I__inc_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID type ref count") done: @@ -1764,7 +1707,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_inc_type_ref + * Function: H5I__inc_type_ref * * Purpose: Increment the reference count for an ID type. * @@ -1777,13 +1720,13 @@ done: * *------------------------------------------------------------------------- */ -int -H5I_inc_type_ref(H5I_type_t type) +static int +H5I__inc_type_ref(H5I_type_t type) { H5I_id_type_t *type_ptr; /* ptr to the type */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(type > 0 && type < H5I_next_type); @@ -1794,11 +1737,11 @@ H5I_inc_type_ref(H5I_type_t type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ - ret_value = (int)(++(type_ptr->count)); + ret_value = (int)(++(type_ptr->init_count)); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_inc_type_ref() */ +} /* end H5I__inc_type_ref() */ /*------------------------------------------------------------------------- @@ -1873,7 +1816,7 @@ H5I_dec_type_ref(H5I_type_t type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->count <= 0) + if(type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* @@ -1882,13 +1825,13 @@ H5I_dec_type_ref(H5I_type_t type) * free all memory it used. The free function is invoked for each atom * being freed. */ - if(1 == type_ptr->count) { - H5I_destroy_type(type); + if(1 == type_ptr->init_count) { + H5I__destroy_type(type); ret_value = 0; } /* end if */ else { - --(type_ptr->count); - ret_value = (herr_t)type_ptr->count; + --(type_ptr->init_count); + ret_value = (herr_t)type_ptr->init_count; } /* end else */ done: @@ -1926,7 +1869,7 @@ H5Iget_type_ref(H5I_type_t type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Do actual retrieve operation */ - if((ret_value = H5I_get_type_ref(type)) < 0) + if((ret_value = H5I__get_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID type ref count") done: @@ -1935,7 +1878,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_type_ref + * Function: H5I__get_type_ref * * Purpose: Retrieve the reference count for an ID type. * @@ -1949,13 +1892,13 @@ done: * *------------------------------------------------------------------------- */ -int -H5I_get_type_ref(H5I_type_t type) +static int +H5I__get_type_ref(H5I_type_t type) { H5I_id_type_t *type_ptr; /*ptr to the type */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(type >= 0); @@ -1966,11 +1909,11 @@ H5I_get_type_ref(H5I_type_t type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Set return value */ - ret_value = (int)type_ptr->count; + ret_value = (int)type_ptr->init_count; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_type_ref() */ +} /* end H5I__get_type_ref() */ /*------------------------------------------------------------------------- @@ -1998,7 +1941,7 @@ H5Iis_valid(hid_t id) H5TRACE1("t", "i", id); /* Find the ID */ - if (NULL == (id_ptr = H5I_find_id(id))) + if (NULL == (id_ptr = H5I__find_id(id))) ret_value = FALSE; /* Check if the found id is an internal id */ @@ -2011,7 +1954,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_search_cb + * Function: H5I__search_cb * * Purpose: Callback routine for H5Isearch, when it calls H5I_iterate. * Calls "user" callback search function, and then sets return @@ -2028,19 +1971,19 @@ done: *------------------------------------------------------------------------- */ static int -H5I_search_cb(void *obj, hid_t id, void *_udata) +H5I__search_cb(void *obj, hid_t id, void *_udata) { H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */ int ret_value; /* Callback return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR ret_value = (*udata->app_cb)(obj, id, udata->app_key); if(ret_value > 0) udata->ret_obj = obj; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_search_cb() */ +} /* end H5I__search_cb() */ /*------------------------------------------------------------------------- @@ -2087,7 +2030,7 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) /* Note that H5I_iterate returns an error code. We ignore it * here, as we can't do anything with it without revising the API. */ - H5I_iterate(type, H5I_search_cb, &udata, TRUE); + (void)H5I_iterate(type, H5I__search_cb, &udata, TRUE); /* Set return value */ ret_value = udata.ret_obj; @@ -2098,6 +2041,46 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__iterate_cb + * + * Purpose: Callback routine for H5I_iterate, invokes "user" callback + * function, and then sets return value, based on the result of + * that callback. + * + * Return: Success: Non-negative on success + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, October 3, 2013 + * + *------------------------------------------------------------------------- + */ +static int +H5I__iterate_cb(void *_item, void UNUSED *_key, void *_udata) +{ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */ + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Don't make callback if app_ref is set and the appl. ref count is 0 */ + if((!udata->app_ref) || (item->app_count > 0)) { + herr_t cb_ret_val; + + /* (Casting away const OK) */ + cb_ret_val = (*udata->user_func)((void *)item->obj_ptr, item->id, udata->user_udata); + if(cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if(cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__iterate_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5I_iterate * * Purpose: Apply function FUNC to each member of type TYPE (with @@ -2139,33 +2122,19 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - /* Only iterate through hash table if it is initialized and there are IDs in group */ - if(type_ptr && type_ptr->count > 0 && type_ptr->ids > 0) { - unsigned u; /* Counter */ - - /* Start at the beginning of the array */ - for(u = 0; u < type_ptr->cls->hash_size; u++) { - H5I_id_info_t *id_ptr; /* Ptr to the new ID */ - - id_ptr = type_ptr->id_list[u]; - while(id_ptr) { - H5I_id_info_t *next_id; /* Ptr to the next ID */ - - /* Protect against ID being deleted in callback */ - next_id = id_ptr->next; - if((!app_ref) || (id_ptr->app_count > 0)) { - herr_t cb_ret_val; /* Callback return value */ - - /* (Casting away const OK) */ - cb_ret_val = (*func)((void *)id_ptr->obj_ptr, id_ptr->id, udata); - if(cb_ret_val > 0) - HGOTO_DONE(SUCCEED) /* terminate iteration early */ - else if(cb_ret_val < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "func failed") - } /* end if */ - id_ptr = next_id; - } /* end while */ - } /* end for */ + /* Only iterate through ID list if it is initialized and there are IDs in type */ + if(type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { + H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ + herr_t iter_status; /* Iteration status */ + + /* Set up iterator user data */ + iter_udata.user_func = func; + iter_udata.user_udata = udata; + iter_udata.app_ref = app_ref; + + /* Iterate over IDs */ + if((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") } /* end if */ done: @@ -2174,7 +2143,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_find_id + * Function: H5I__find_id * * Purpose: Given an object ID find the info struct that describes the * object. @@ -2188,16 +2157,13 @@ done: *------------------------------------------------------------------------- */ static H5I_id_info_t * -H5I_find_id(hid_t id) +H5I__find_id(hid_t id) { H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *last_id; /*ptr to the last ID */ - H5I_id_info_t *id_ptr; /*ptr to the new ID */ H5I_type_t type; /*ID's type */ - unsigned hash_loc; /*bucket pointer */ H5I_id_info_t *ret_value; /*return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ type = H5I_TYPE(id); @@ -2205,35 +2171,15 @@ H5I_find_id(hid_t id) HGOTO_DONE(NULL); type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->count <= 0) + if (!type_ptr || type_ptr->init_count <= 0) HGOTO_DONE(NULL); - /* Get the bucket in which the ID is located */ - hash_loc = (unsigned)H5I_LOC(id, type_ptr->cls->hash_size); - id_ptr = type_ptr->id_list[hash_loc]; - - /* Scan the bucket's linked list for a match */ - last_id = NULL; - while(id_ptr) { - if(id_ptr->id == id) { - /* If we found an object, move it to the front of the list, if it isn't there already */ - if(last_id != NULL) { - last_id->next = id_ptr->next; - id_ptr->next = type_ptr->id_list[hash_loc]; - type_ptr->id_list[hash_loc] = id_ptr; - } /* end if */ - break; - } /* end if */ - last_id = id_ptr; - id_ptr = id_ptr->next; - } /* end while */ - - /* Set the return value */ - ret_value = id_ptr; + /* Locate the ID node for the ID */ + ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_find_id() */ +} /* end H5I__find_id() */ /*------------------------------------------------------------------------- @@ -2364,9 +2310,66 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_file_id() */ +#ifdef H5I_DEBUG_OUTPUT /*------------------------------------------------------------------------- - * Function: H5I_debug + * Function: H5I__debug_cb + * + * Purpose: Dump the contents of an ID to stderr for debugging. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Robb Matzke + * Friday, February 19, 1999 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5I__debug_cb(void *_item, void UNUSED *_key, void *_udata) +{ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ + H5G_name_t *path = NULL; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + fprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); + fprintf(stderr, " count = %u\n", item->count); + fprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); + + /* Get the group location, so we get get the name */ + switch(type) { + case H5I_GROUP: + path = H5G_nameof((H5G_t*)item->obj_ptr); + break; + + case H5I_DATASET: + path = H5D_nameof((H5D_t*)item->obj_ptr); + break; + + case H5I_DATATYPE: + path = H5T_nameof((H5T_t*)item->obj_ptr); + break; + + default: + break; /* Other types of IDs are not stored in files */ + } /* end switch*/ + + if(path) { + if(path->user_path_r) + fprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); + if(path->full_path_r) + fprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5I__debug_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5I__debug * * Purpose: Dump the contents of a type to stderr for debugging. * @@ -2378,74 +2381,28 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5I_DEBUG_OUTPUT static herr_t -H5I_debug(H5I_type_t type) +H5I__debug(H5I_type_t type) { H5I_id_type_t *type_ptr; - H5I_id_info_t *cur; - H5G_name_t *path; - int is, js; - unsigned int iu; - herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC_NOERR fprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; /* Header */ - fprintf(stderr, " count = %u\n", type_ptr->count); - fprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - fprintf(stderr, " wrapped = %u\n", type_ptr->wrapped); - fprintf(stderr, " hash_size = %lu\n", (unsigned long)type_ptr->cls->hash_size); - fprintf(stderr, " ids = %u\n", type_ptr->ids); - fprintf(stderr, " nextid = %u\n", type_ptr->nextid); - - /* Cache */ - fprintf(stderr, " Cache:\n"); - for (is=0; isid)==type) { - fprintf(stderr, " Entry-%d, ID=%lu\n", - is, (unsigned long)(H5I_cache_g[is]->id)); - } - } + fprintf(stderr, " init_count = %u\n", type_ptr->init_count); + fprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + fprintf(stderr, " wrapped = %u\n", type_ptr->wrapped); + fprintf(stderr, " id_count = %u\n", type_ptr->id_count); + fprintf(stderr, " nextid = %u\n", type_ptr->nextid); /* List */ fprintf(stderr, " List:\n"); - for (iu=0; iuhash_size; iu++) { - for (js=0, cur=type_ptr->id_list[iu]; cur; cur=cur->next, js++) { - fprintf(stderr, " #%u.%d\n", iu, js); - fprintf(stderr, " id = %lu\n", (unsigned long)(cur->id)); - fprintf(stderr, " count = %u\n", cur->count); - fprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(cur->obj_ptr)); - - /* Get the group location, so we get get the name */ - switch(type) { - case H5I_GROUP: - path = H5G_nameof((H5G_t*)cur->obj_ptr); - break; - case H5I_DATASET: - path = H5D_nameof((H5D_t*)cur->obj_ptr); - break; - case H5I_DATATYPE: - path = H5T_nameof((H5T_t*)cur->obj_ptr); - break; - default: - continue; /* Other types of IDs are not stored in files */ - } /* end switch*/ - - if(path) { - if(path->user_path_r) - fprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); - if(ent->canon_path_r) - fprintf(stderr, " canon_path = %s\n", H5RS_get_str(path->canon_path_r)); - } /* end if */ - } /* end for */ - } /* end for */ + H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type); -done: FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5I_debug() */ +} /* end H5I__debug() */ #endif /* H5I_DEBUG_OUTPUT */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 125c3f6..af8b6ca 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -46,7 +46,6 @@ typedef struct H5I_class_t { H5I_type_t type_id; /* Class ID for the type */ unsigned flags; /* Class behavior flags */ - size_t hash_size; /* Minimum hash table size for the type */ unsigned reserved; /* Number of reserved IDs for this type */ /* [A specific number of type entries may be * reserved to enable "constant" values to be @@ -69,7 +68,6 @@ typedef struct H5I_class_t { H5_DLL herr_t H5I_register_type(const H5I_class_t *cls); H5_DLL int H5I_nmembers(H5I_type_t type); H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref); -H5_DLL int H5I_destroy_type(H5I_type_t type); H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); H5_DLL herr_t H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id); H5_DLL void *H5I_subst(hid_t id, const void *new_object); @@ -78,16 +76,13 @@ H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL H5I_type_t H5I_get_type(hid_t id); H5_DLL hid_t H5I_get_file_id(hid_t obj_id, hbool_t app_ref); H5_DLL void *H5I_remove(hid_t id); -H5_DLL void *H5I_remove_verify(hid_t id, H5I_type_t id_type); H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref); H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref); H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref); H5_DLL int H5I_dec_ref(hid_t id); H5_DLL int H5I_dec_app_ref(hid_t id); H5_DLL int H5I_dec_app_ref_always_close(hid_t id); -H5_DLL int H5I_inc_type_ref(H5I_type_t type); H5_DLL herr_t H5I_dec_type_ref(H5I_type_t type); -H5_DLL int H5I_get_type_ref(H5I_type_t type); #endif /* _H5Iprivate_H */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 269f064..ea29ab3 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2481,7 +2481,7 @@ H5P__facc_cache_config_cmp(const void *_config1, const void *_config2, size_t UN if(config1->close_trace_file > config2->close_trace_file) HGOTO_DONE(1); if((ret_value = HDstrncmp(config1->trace_file_name, config2->trace_file_name, - H5AC__MAX_TRACE_FILE_NAME_LEN + 1)) != 0) + (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1))) != 0) HGOTO_DONE(ret_value); if(config1->evictions_enabled < config2->evictions_enabled) HGOTO_DONE(-1); diff --git a/src/H5Pint.c b/src/H5Pint.c index 40d0a9c..c2a17ba 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -269,7 +269,6 @@ H5FL_DEFINE_STATIC(H5P_genplist_t); static const H5I_class_t H5I_GENPROPCLS_CLS[1] = {{ H5I_GENPROP_CLS, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5P_close_class /* Callback routine for closing objects of this class */ }}; @@ -278,7 +277,6 @@ static const H5I_class_t H5I_GENPROPCLS_CLS[1] = {{ static const H5I_class_t H5I_GENPROPLST_CLS[1] = {{ H5I_GENPROP_LST, /* ID class value */ 0, /* Class flags */ - 128, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ (H5I_free_t)H5P_close /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5R.c b/src/H5R.c index bf8ffba..97b6f61 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -77,7 +77,6 @@ static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id, static const H5I_class_t H5I_REFERENCE_CLS[1] = {{ H5I_REFERENCE, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 0, /* # of reserved IDs for class */ NULL /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5S.c b/src/H5S.c index 2eebba4..7fabd88 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -90,7 +90,6 @@ H5FL_ARR_DEFINE(hsize_t,H5S_MAX_RANK); static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ H5I_DATASPACE, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 2, /* # of reserved IDs for class */ (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5SL.c b/src/H5SL.c index 2e2ad1e..2e72819 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -549,10 +549,12 @@ H5SL_init_interface(void) /* Allocate space for array of factories */ H5SL_fac_g = (H5FL_fac_head_t **)H5MM_malloc(sizeof(H5FL_fac_head_t *)); + HDassert(H5SL_fac_g); H5SL_fac_nalloc_g = 1; /* Initialize first factory */ H5SL_fac_g[0] = H5FL_fac_init(sizeof(H5SL_node_t *)); + HDassert(H5SL_fac_g[0]); H5SL_fac_nused_g = 1; FUNC_LEAVE_NOAPI(SUCCEED) @@ -681,6 +683,10 @@ H5SL_insert_common(H5SL_t *slist, void *item, const void *key) H5SL_INSERT(OBJ, slist, prev, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_INSERT(SCALAR, slist, prev, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_INSERT(GENERIC, slist, prev, const void, key, -) break; @@ -1110,6 +1116,10 @@ H5SL_remove(H5SL_t *slist, const void *key) H5SL_REMOVE(OBJ, slist, x, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_REMOVE(SCALAR, slist, x, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_REMOVE(GENERIC, slist, x, const void, key, -) break; @@ -1293,6 +1303,10 @@ H5SL_search(H5SL_t *slist, const void *key) H5SL_SEARCH(OBJ, slist, x, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_SEARCH(SCALAR, slist, x, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_SEARCH(GENERIC, slist, x, const void, key, -) break; @@ -1382,6 +1396,10 @@ H5SL_less(H5SL_t *slist, const void *key) H5SL_SEARCH(OBJ, slist, x, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_SEARCH(SCALAR, slist, x, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_SEARCH(GENERIC, slist, x, const void, key, -) break; @@ -1484,6 +1502,10 @@ H5SL_greater(H5SL_t *slist, const void *key) H5SL_SEARCH(OBJ, slist, x, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_SEARCH(SCALAR, slist, x, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_SEARCH(GENERIC, slist, x, const void, key, -) break; @@ -1576,6 +1598,10 @@ H5SL_find(H5SL_t *slist, const void *key) H5SL_FIND(OBJ, slist, x, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_FIND(SCALAR, slist, x, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_FIND(GENERIC, slist, x, const void, key, -) break; @@ -1665,6 +1691,10 @@ H5SL_below(H5SL_t *slist, const void *key) H5SL_FIND(OBJ, slist, x, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_FIND(SCALAR, slist, x, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_FIND(GENERIC, slist, x, const void, key, -) break; @@ -1767,6 +1797,10 @@ H5SL_above(H5SL_t *slist, const void *key) H5SL_FIND(OBJ, slist, x, const H5_obj_t, key, -) break; + case H5SL_TYPE_HID: + H5SL_FIND(SCALAR, slist, x, const hid_t, key, -) + break; + case H5SL_TYPE_GENERIC: H5SL_FIND(GENERIC, slist, x, const void, key, -) break; @@ -1994,7 +2028,8 @@ H5SL_item(H5SL_node_t *slist_node) herr_t H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data) { - H5SL_node_t *node; /* Pointers to skip list nodes */ + H5SL_node_t *node; /* Pointer to current skip list node */ + H5SL_node_t *next; /* Pointer to next skip list node */ herr_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2008,12 +2043,16 @@ H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data) /* Free skip list nodes */ node = slist->header->forward[0]; while(node != NULL) { + /* Protect against the node being deleted by the callback */ + next = node->forward[0]; + /* Call the iterator callback */ /* Casting away const OK -QAK */ if((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0) break; - node = node->forward[0]; + /* Advance to next node */ + node = next; } /* end while */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5SLprivate.h b/src/H5SLprivate.h index 07ee414..ce2f091 100644 --- a/src/H5SLprivate.h +++ b/src/H5SLprivate.h @@ -48,6 +48,7 @@ typedef enum { H5SL_TYPE_UNSIGNED, /* Skip list keys are 'unsigned's */ H5SL_TYPE_SIZE, /* Skip list keys are 'size_t's */ H5SL_TYPE_OBJ, /* Skip list keys are 'H5_obj_t's */ + H5SL_TYPE_HID, /* Skip list keys are 'hid_t's */ H5SL_TYPE_GENERIC /* Skip list keys are unknown, comparison callback supplied */ } H5SL_type_t; diff --git a/src/H5T.c b/src/H5T.c index 12b7801..d545c4e 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -528,7 +528,6 @@ H5FL_DEFINE_STATIC(H5T_path_t); static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ H5I_DATATYPE, /* ID class value */ 0, /* Class flags */ - 64, /* Minimum hash size for class */ 8, /* # of reserved IDs for class */ (H5I_free_t)H5T_close /* Callback routine for closing objects of this class */ }}; diff --git a/src/H5detect.c b/src/H5detect.c index be661ea..3554d50 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -124,7 +124,7 @@ static int bit_cmp(int, int *, volatile void *, volatile void *, static void fix_order(int, int, int *, const char **); static int imp_bit(int, int *, volatile void *, volatile void *, const unsigned char *); -static unsigned long find_bias(int, int, int *, void *); +static unsigned long find_bias(int, int, int *, volatile void *); static void precision (detected_t*); static void print_header(void); static void detect_C89_integers(void); @@ -1135,7 +1135,7 @@ imp_bit(int n, int *perm, volatile void *_a, volatile void *_b, *------------------------------------------------------------------------- */ static unsigned long -find_bias(int epos, int esize, int *perm, void *_a) +find_bias(int epos, int esize, int *perm, volatile void *_a) { unsigned char *a = (unsigned char *) _a; unsigned char mask; diff --git a/src/H5private.h b/src/H5private.h index 2bfcb70..f54bd9d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -277,12 +277,15 @@ #ifdef __cplusplus # define __attribute__(X) /*void*/ # define UNUSED /*void*/ +# define NORETURN /*void*/ #else /* __cplusplus */ #ifdef H5_HAVE_ATTRIBUTE # define UNUSED __attribute__((unused)) +# define NORETURN __attribute__((noreturn)) #else # define __attribute__(X) /*void*/ # define UNUSED /*void*/ +# define NORETURN /*void*/ #endif #endif /* __cplusplus */ diff --git a/src/H5public.h b/src/H5public.h index eccf503..04b9423 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 165 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 167 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "swmr_chksum0" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.165-swmr_chksum0" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.167-swmr_chksum0" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) @@ -195,7 +195,7 @@ typedef signed long long hssize_t; #elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG # define H5_PRINTF_HADDR_FMT "%lu" #elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG_LONG -# define H5_PRINTF_HADDR_FMT "%"H5_PRINTF_LL_WIDTH"u" +# define H5_PRINTF_HADDR_FMT "%" H5_PRINTF_LL_WIDTH "u" #else # error "nothing appropriate for H5_PRINTF_HADDR_FMT" #endif diff --git a/src/H5system.c b/src/H5system.c index 4280066..614b8b9 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -201,7 +201,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) if(sizeof(hsize_t) < sizeof(long)) modifier[0] = '\0'; else if(sizeof(hsize_t) == sizeof(long)) - HDstrncpy(modifier, "l", 2); + HDstrncpy(modifier, "l", (size_t)2); else HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1); break; @@ -211,7 +211,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) if(sizeof(size_t) < sizeof(long)) modifier[0] = '\0'; else if(sizeof(size_t) == sizeof(long)) - HDstrncpy(modifier, "l", 2); + HDstrncpy(modifier, "l", (size_t)2); else HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1); break; diff --git a/src/H5win32defs.h b/src/H5win32defs.h index d452925..185e9b4 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -74,7 +74,7 @@ struct timezone { extern "C" { #endif /* __cplusplus */ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); - H5_DLL char* Wgetlogin(); + H5_DLL char* Wgetlogin(void); H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); #ifdef __cplusplus diff --git a/src/Makefile.in b/src/Makefile.in index a1666be..104a7ed 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -523,7 +523,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 = 155 +LT_VERS_REVISION = 157 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/test/big.c b/test/big.c index 5a70c26..7465e47 100644 --- a/test/big.c +++ b/test/big.c @@ -395,7 +395,8 @@ writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n) break; default: - HDassert(0 && "Invalid test size."); + HDfprintf(stdout, "Unexpected file size(%d)\n", testsize); + goto error; break; } @@ -435,7 +436,8 @@ writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n) hs_size[0] = WRT_SIZE; if ((mem_space = H5Screate_simple (1, hs_size, hs_size)) < 0) goto error; for (i=0; i" */ /* pre-condition: num must be a non-negative number */ -static int num_digits(int num) +static unsigned +num_digits(int num) { - int i; + unsigned u; - if (num == 0) - return 1; + if(num == 0) + return 1; - for (i = 0; num > 0; i++) - num = num / 10; + for(u = 0; num > 0; u++) + num = num / 10; - return i; + return u; } /* Routine to generate attribute names for numeric values */ char *gen_name(int value) { - char *temp; - int i, length; + char *temp; + unsigned length; + int i; - length = num_digits(MAX_NUM_NAME - 1); - temp = (char *)HDmalloc((NAME_OFFSET + length + 1) * sizeof(char)); - temp = HDstrcpy(temp, "attrib"); - temp[NAME_OFFSET + length] = '\0'; + length = num_digits(MAX_NUM_NAME - 1); + temp = (char *)HDmalloc(NAME_OFFSET + length + 1); + temp = HDstrcpy(temp, "attrib"); + temp[NAME_OFFSET + length] = '\0'; - for (i = length - 1; i >= 0; i--) { - temp[NAME_OFFSET + i] = (char)((int)'0' + value % 10); - value = value / 10; - } + for (i = (int)(length - 1); i >= 0; i--) { + temp[NAME_OFFSET + i] = (char)((int)'0' + value % 10); + value = value / 10; + } - return temp; + return temp; } int main(int argc, char *argv[]) { - /* Initialize testing framework */ - TestInit(argv[0], NULL, NULL); + /* Initialize testing framework */ + TestInit(argv[0], NULL, NULL); - /* Tests are generally arranged from least to most complexity... */ - AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation", NULL); - AddTest("error", tts_error, cleanup_error, "per-thread error stacks", NULL); + /* Tests are generally arranged from least to most complexity... */ + AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation", NULL); + AddTest("error", tts_error, cleanup_error, "per-thread error stacks", NULL); #ifdef H5_HAVE_PTHREAD_H - /* Thread cancellability only supported with pthreads ... */ - AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL); + /* Thread cancellability only supported with pthreads ... */ + AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL); #endif /* H5_HAVE_PTHREAD_H */ - AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL); + AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL); - /* Display testing information */ - TestInfo(argv[0]); + /* Display testing information */ + TestInfo(argv[0]); - /* Parse command line arguments */ - TestParseCmdLine(argc,argv); + /* Parse command line arguments */ + TestParseCmdLine(argc,argv); - /* Perform requested testing */ - PerformTests(); + /* Perform requested testing */ + PerformTests(); - /* Display test summary, if requested */ - if (GetTestSummary()) - TestSummary(); + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(); - /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) - TestCleanup(); + /* Clean up test files, if allowed */ + if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) + TestCleanup(); - return GetTestNumErrs(); + return GetTestNumErrs(); } /* end main() */ #endif /*H5_HAVE_THREADSAFE*/ diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 02a76ca..517f496 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -4975,7 +4975,7 @@ static void test_data_nocomparables (const char * fname, int make_diffs) int data1[DIM_ARRY] = {0,0,0}; int data2[DIM_ARRY] = {1,1,1}; int data3[DIM_ARRY+1] = {1,1,1,1}; - int data1_dim2[DIM_ARRY][1] = {0,0,0}; + int data1_dim2[DIM_ARRY][1] = {{0},{0},{0}}; int rank_attr; char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"}; herr_t status = SUCCEED; diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 3815679..7e0ff46 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -21,6 +21,8 @@ #define PROGRAMNAME "h5repack" static int parse_command_line(int argc, const char **argv, pack_opt_t* options); +static void leave(int ret) NORETURN; + /* module-scoped variables */ static int has_i_o = 0; @@ -564,7 +566,6 @@ done: int main(int argc, const char **argv) { pack_opt_t options; /*the global options */ - int ret = -1; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index d08c23f..cfd171a 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -40,8 +40,8 @@ #define UI_FORMAT "%-15u %-15u %-15u\n" #define LI_FORMAT "%-15ld %-15ld %-15ld\n" #define ULI_FORMAT "%-15lu %-15lu %-15lu\n" -#define LLI_FORMAT "%-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d\n" -#define ULLI_FORMAT "%-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u\n" +#define LLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d\n" +#define ULLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u\n" /* with -p option */ #define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n" @@ -54,8 +54,8 @@ #define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n" #define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n" #define ULI_FORMAT_P "%-15lu %-15lu %-15lu %-14f\n" -#define LLI_FORMAT_P "%-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d %-14f\n" -#define ULLI_FORMAT_P "%-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"d %-14f\n" +#define LLI_FORMAT_P "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-14f\n" +#define ULLI_FORMAT_P "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d %-14f\n" #define SPACES " " /* not comparable */ @@ -69,8 +69,8 @@ #define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n" #define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n" #define ULI_FORMAT_P_NOTCOMP "%-15lu %-15lu %-15lu not comparable\n" -#define LLI_FORMAT_P_NOTCOMP "%-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d %-15"H5_PRINTF_LL_WIDTH"d not comparable\n" -#define ULLI_FORMAT_P_NOTCOMP "%-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"d not comparable\n" +#define LLI_FORMAT_P_NOTCOMP "%-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d %-15" H5_PRINTF_LL_WIDTH "d not comparable\n" +#define ULLI_FORMAT_P_NOTCOMP "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "d not comparable\n" /* if system EPSILON is defined, use the system EPSILON; otherwise, use diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d9a1827..1794342 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -878,18 +878,18 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); } } if (elmtno == 0 && secnum == 0 && info->line_1st) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); } else if (secnum && info->line_cont) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); } else { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); } templength = h5tools_str_len(&prefix); @@ -897,7 +897,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -973,18 +973,18 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); } } if (elmtno == 0 && secnum == 0 && info->line_1st) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); } else if (secnum && info->line_cont) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); } else { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); } templength = h5tools_str_len(&prefix); @@ -992,7 +992,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -1049,7 +1049,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, if (stream == NULL) return dimension_break; - s = h5tools_str_fmt(buffer, 0, "%s"); + s = h5tools_str_fmt(buffer, (size_t)0, "%s"); /* * If the element would split on multiple lines if printed at our @@ -1203,7 +1203,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, int secnum; /*section sequence number */ int multiline; /*datum was multiline */ - s = h5tools_str_fmt(buffer, 0, "%s"); + s = h5tools_str_fmt(buffer, (size_t)0, "%s"); /* * If the element would split on multiple lines if printed at our diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 47e1f41..2e61ad0 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -32,7 +32,7 @@ #define END_OF_DATA 0x0002 /* format for hsize_t */ -#define HSIZE_T_FORMAT "%"H5_PRINTF_LL_WIDTH"u" +#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u" #define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index ee61ac7..7e3c1c9 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -364,7 +364,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, } /* Add prefix and suffix to the index */ - return h5tools_str_fmt(str, 0, OPT(info->idx_fmt, "%s: ")); + return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); } /*------------------------------------------------------------------------- @@ -424,7 +424,7 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, } /* Add prefix and suffix to the index */ - return h5tools_str_fmt(str, 0, OPT(info->idx_fmt, "%s: ")); + return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 58d7959..a475ded 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -49,7 +49,7 @@ typedef struct { } trav_print_udata_t; /* format for hsize_t */ -#define HSIZE_T_FORMAT "%"H5_PRINTF_LL_WIDTH"u" +#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u" /*------------------------------------------------------------------------- * local functions diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 8aa4000..c79995d 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.165-swmr_chksum0" +#define H5_PACKAGE_STRING "HDF5 1.9.167-swmr_chksum0" /* 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.165-swmr_chksum0" +#define H5_PACKAGE_VERSION "1.9.167-swmr_chksum0" /* 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.165-swmr_chksum0" +#define H5_VERSION "1.9.167-swmr_chksum0" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12