summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-10-13 09:33:03 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-10-13 09:33:03 (GMT)
commitb767c1a0ae221b4d39cead548bd26a229a8529c9 (patch)
tree452bd065fea24fa0b3d0bbfe5d26f61812bb8948
parent76ff9fa1d25f2f060b6ef620a9c6d1a1652c6fa8 (diff)
downloadhdf5-b767c1a0ae221b4d39cead548bd26a229a8529c9.zip
hdf5-b767c1a0ae221b4d39cead548bd26a229a8529c9.tar.gz
hdf5-b767c1a0ae221b4d39cead548bd26a229a8529c9.tar.bz2
[svn-r28049] Merge of r27997-28047 from the trunk.
Tested on: Ubuntu 15.04 (Linux 3.19 x86_64) gcc 4.9.2 serial w/ Fortran and C++ parallel (MPICH 3.1.4) w/ Fortran
-rwxr-xr-xbin/bbrelease1
-rw-r--r--c++/src/H5AbstractDs.cpp12
-rw-r--r--c++/src/H5AbstractDs.h4
-rw-r--r--c++/src/H5Attribute.h2
-rw-r--r--c++/src/H5CppDoc.h8
-rw-r--r--c++/src/H5DataSet.cpp26
-rw-r--r--c++/src/H5DataType.cpp7
-rw-r--r--c++/src/H5DataType.h3
-rw-r--r--c++/src/H5DcreatProp.h3
-rw-r--r--c++/src/H5DxferProp.h4
-rw-r--r--c++/src/H5Exception.cpp6
-rw-r--r--c++/src/H5Exception.h4
-rw-r--r--c++/src/H5FaccProp.h3
-rw-r--r--c++/src/H5File.cpp84
-rw-r--r--c++/src/H5FloatType.h8
-rw-r--r--c++/src/H5IdComponent.cpp36
-rw-r--r--c++/src/H5IdComponent.h36
-rw-r--r--c++/src/H5Library.cpp72
-rw-r--r--c++/src/H5Library.h10
-rw-r--r--c++/src/H5Location.h3
-rw-r--r--c++/src/H5PropList.h3
-rw-r--r--fortran/src/H5Of.c8
-rw-r--r--fortran/src/H5Tf.c3
-rw-r--r--hl/src/H5LTparse.y13
-rw-r--r--hl/test/test_lite.c1
-rw-r--r--src/H5Fsuper.c1
-rw-r--r--src/H5G.c2
-rw-r--r--testpar/t_mpi.c18
-rw-r--r--tools/lib/h5diff_attr.c8
29 files changed, 207 insertions, 182 deletions
diff --git a/bin/bbrelease b/bin/bbrelease
index 119dc7a..cb79528 100755
--- a/bin/bbrelease
+++ b/bin/bbrelease
@@ -304,7 +304,6 @@ fi
# Create a manifest that contains only files for distribution.
MANIFEST=$tmpdir/H5_MANIFEST
grep '^\.' MANIFEST | grep -v _DO_NOT_DISTRIBUTE_ >$MANIFEST
-echo "./autogen.sh" >>$MANIFEST
# Prepare the source tree for a release.
#ln -s `pwd` $tmpdir/$HDF5_VERS || exit 1
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index 5929444..06b3e22 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -52,18 +52,6 @@ AbstractDs::AbstractDs(){}
AbstractDs::AbstractDs(const hid_t ds_id){}
//--------------------------------------------------------------------------
-// Function: AbstractDs copy constructor
-///\brief Copy constructor: makes a copy of the original AbstractDs object.
-// Programmer Binh-Minh Ribler - 2000
-// *** Deprecation warning ***
-// This constructor is no longer appropriate because the data member "id" had
-// been moved to the sub-classes. It is removed from 1.8.15 because it is
-// a noop and it can be generated by the compiler if needed.
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-// AbstractDs::AbstractDs(const AbstractDs& original){}
-
-//--------------------------------------------------------------------------
// Function: AbstractDs::getTypeClass
///\brief Returns the class of the datatype that is used by this
/// object, which can be a dataset or an attribute.
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h
index 810dc8b..ee2e45e 100644
--- a/c++/src/H5AbstractDs.h
+++ b/c++/src/H5AbstractDs.h
@@ -68,7 +68,7 @@ class H5_DLLCPP AbstractDs {
///\brief Returns the amount of storage size required - pure virtual.
virtual hsize_t getStorageSize() const = 0;
- ///\brief Returns this class name.
+ // Returns this class name - pure virtual.
virtual H5std_string fromClass() const = 0;
// Destructor
@@ -91,7 +91,7 @@ class H5_DLLCPP AbstractDs {
// AbstractDs( const AbstractDs& original );
private:
- // This member function is implemented by DataSet and Attribute.
+ // This member function is implemented by DataSet and Attribute - pure virtual.
virtual hid_t p_get_type() const = 0;
};
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index eced64e..f5ee4a9 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -86,8 +86,8 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
// Destructor: properly terminates access to this attribute.
virtual ~Attribute();
- protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ protected:
// Sets the attribute id.
virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h
index 388fc25..2420586 100644
--- a/c++/src/H5CppDoc.h
+++ b/c++/src/H5CppDoc.h
@@ -29,10 +29,10 @@
* The C++ API provides C++ wrappers for the HDF5 C Library.
*
* It is assumed that the user has knowledge of the
- * <a href="http://www.hdfgroup.org/HDF5/doc/H5.format.html">
+ * <a href="https://www.hdfgroup.org/HDF5/doc/H5.format.html">
* HDF5 file format</a> and its components.
* For more information on the HDF5 C Library, see the
- * <a href="http://www.hdfgroup.org/HDF5/doc/index.html">
+ * <a href="https://www.hdfgroup.org/HDF5/doc/index.html">
* HDF5 Software Documentation</a> page.
*
* Because the HDF5 C Library maps very well to
@@ -57,8 +57,8 @@
*
* The HDF5 C++ API is included with the HDF5 source code and can
* be obtained from
- * <a href="http://www.hdfgroup.org/HDF5/release/obtainsrc.html">
- * http://www.hdfgroup.org/HDF5/release/obtainsrc.html</a>.
+ * <a href="https://www.hdfgroup.org/HDF5/release/obtainsrc.html">
+ * https://www.hdfgroup.org/HDF5/release/obtainsrc.html</a>.
*
* Please refer to the release_docs/INSTALL file under the top directory
* of the HDF5 source code for information about installing, building,
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 0fc9105..059da85 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -60,6 +60,12 @@ DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {}
///\brief Creates an DataSet object using the id of an existing dataset.
///\param existing_id - IN: Id of an existing dataset
// Programmer Binh-Minh Ribler - 2000
+// Description
+// incRefCount() is needed here to prevent the id from being closed
+// prematurely. That is, when application uses the id of an
+// existing DataSet object to create another DataSet object. So,
+// when one of those objects is deleted, the id will be closed if
+// the reference counter is only 1.
//--------------------------------------------------------------------------
DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs()
{
@@ -172,8 +178,10 @@ DSetCreatPropList DataSet::getCreatePlist() const
{
throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
}
+
// create and return the DSetCreatPropList object
- DSetCreatPropList create_plist(create_plist_id); // ok to use existing id const
+ DSetCreatPropList create_plist;
+ f_PropList_setId(&create_plist, create_plist_id);
return(create_plist);
}
@@ -772,6 +780,22 @@ void DataSet::p_setId(const hid_t new_id)
// reset object's id to the given id
id = new_id;
}
+
+//--------------------------------------------------------------------------
+// Function: f_PropList_setId - friend
+// Purpose: This function is friend to class H5::PropList so that it
+// can set PropList::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dset - IN/OUT: DataSet object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_PropList_setId(PropList* plist, hid_t new_id)
+{
+ plist->p_setId(new_id);
+}
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 88dff89..1bbabe3 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -144,10 +144,10 @@ DataType::DataType(const DataType& original) : H5Object()
//--------------------------------------------------------------------------
// Function: DataType overloaded constructor
-///\brief Creates a integer type using a predefined type
+///\brief Creates a DataType instance using a predefined type
///\param pred_type - IN: Predefined datatype
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2015
// Description
// Copying the type so that when a predefined type is passed in,
// a copy of it is made, not just a duplicate of the HDF5 id.
@@ -239,8 +239,7 @@ DataType& DataType::operator=( const DataType& rhs )
{
if (this != &rhs)
{
- id = rhs.id;
- incRefCount(); // increment number of references to this id
+ setId(rhs.id);
}
return(*this);
}
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 6c8a312..5705b83 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -14,6 +14,9 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+// Class DataType inherits from H5Object and has several subclasses for
+// specific HDF5 data types.
+
#ifndef __H5DataType_H
#define __H5DataType_H
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index ebdadc4..792956a 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -14,6 +14,9 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+// Class DSetCreatPropList represents the HDF5 dataset creation property list
+// and inherits from PropList.
+
#ifndef __H5DSCreatPropList_H
#define __H5DSCreatPropList_H
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 85d2ec2..52a9a48 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -14,6 +14,9 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+// Class DSetMemXferPropList represents the HDF5 dataset transfer property list
+// and inherits from PropList.
+
#ifndef __H5DSetMemXferPropList_H
#define __H5DSetMemXferPropList_H
@@ -132,4 +135,3 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
}
#endif
#endif // __H5DSetMemXferPropList_H
-
diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp
index fb1e42e..1ca059b 100644
--- a/c++/src/H5Exception.cpp
+++ b/c++/src/H5Exception.cpp
@@ -309,9 +309,9 @@ const char* Exception::getCFuncName() const
//--------------------------------------------------------------------------
void Exception::printErrorStack(FILE* stream, hid_t err_stack)
{
- herr_t ret_value = H5Eprint2(err_stack, stream);
- if( ret_value < 0 )
- throw Exception( "Printing error stack", "H5Eprint2 failed" );
+ herr_t ret_value = H5Eprint2(err_stack, stream);
+ if( ret_value < 0 )
+ throw Exception( "Printing error stack", "H5Eprint2 failed" );
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index 639b633..d49c19a 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -86,8 +86,8 @@ class H5_DLLCPP Exception {
virtual ~Exception() throw();
protected:
- // Default value for detail_message
- static const char DEFAULT_MSG[];
+ // Default value for detail_message
+ static const char DEFAULT_MSG[];
private:
H5std_string detail_message;
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index 7d6529e..b214447 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -14,6 +14,9 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+// Class FileAccPropList represents the HDF5 file access property list and
+// inherits from DataType.
+
#ifndef __H5FileAccPropList_H
#define __H5FileAccPropList_H
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 44fc53c..b169472 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -133,28 +133,26 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
// create the file.
if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))
{
- hid_t create_plist_id = create_plist.getId();
- hid_t access_plist_id = access_plist.getId();
- id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
- if( id < 0 ) // throw an exception when open/create fail
- {
- throw FileIException("H5File constructor", "H5Fcreate failed");
- }
+ hid_t create_plist_id = create_plist.getId();
+ hid_t access_plist_id = access_plist.getId();
+ id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
+ if( id < 0 ) // throw an exception when open/create fail
+ {
+ throw FileIException("H5File constructor", "H5Fcreate failed");
+ }
}
// Open the file if none of the bits above are set.
else
{
- hid_t access_plist_id = access_plist.getId();
- id = H5Fopen( name, flags, access_plist_id );
- if( id < 0 ) // throw an exception when open/create fail
- {
- throw FileIException("H5File constructor", "H5Fopen failed");
- }
+ hid_t access_plist_id = access_plist.getId();
+ id = H5Fopen( name, flags, access_plist_id );
+ if( id < 0 ) // throw an exception when open/create fail
+ {
+ throw FileIException("H5File constructor", "H5Fopen failed");
+ }
}
}
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
//--------------------------------------------------------------------------
// Function: H5File overloaded constructor
///\brief Creates an H5File object using an existing file id.
@@ -174,6 +172,8 @@ H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
incRefCount(); // increment number of references to this id
}
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
//--------------------------------------------------------------------------
// Function: H5File copy constructor
///\brief Copy constructor: makes a copy of the original
@@ -523,16 +523,16 @@ hsize_t H5File::getFileSize() const
}
//--------------------------------------------------------------------------
-// Function: H5File::getId
+// Function: H5File::getId
///\brief Get the id of this file
///\return File identifier
// Modification:
-// May 2008 - BMR
-// Class hierarchy is revised to address bugzilla 1068. Class
-// AbstractDS and Attribute are moved out of H5Object. In
-// addition, member IdComponent::id is moved into subclasses, and
-// IdComponent::getId now becomes pure virtual function.
-// Programmer Binh-Minh Ribler - May, 2008
+// May 2008 - BMR
+// Class hierarchy is revised to address bugzilla 1068. Class
+// AbstractDS and Attribute are moved out of H5Object. In
+// addition, member IdComponent::id is moved into subclasses, and
+// IdComponent::getId now becomes pure virtual function.
+// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
hid_t H5File::getId() const
{
@@ -541,42 +541,42 @@ hid_t H5File::getId() const
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5File::getLocId
-// Purpose: Get the id of this file
+// Function: H5File::reopen
+// Purpose: Reopens this file.
+// Exception H5::FileIException
// Description
-// This function is a redefinition of CommonFG::getLocId. It
-// is used by CommonFG member functions to get the file id.
+// This function is replaced by the above function reOpen.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hid_t H5File::getLocId() const
+void H5File::reopen()
{
- return( getId() );
+ H5File::reOpen();
}
//--------------------------------------------------------------------------
-// Function: H5File::reopen
-// Purpose: Reopens this file.
-// Exception H5::FileIException
+// Function: H5File::getLocId
+// Purpose: Get the id of this file
// Description
-// This function is replaced by the above function reOpen.
+// This function is a redefinition of CommonFG::getLocId. It
+// is used by CommonFG member functions to get the file id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5File::reopen()
+hid_t H5File::getLocId() const
{
- H5File::reOpen();
+ return( getId() );
}
//--------------------------------------------------------------------------
-// Function: H5File::p_setId (protected)
-///\brief Sets the identifier of this object to a new value.
+// Function: H5File::p_setId (protected)
+///\brief Sets the identifier of this object to a new value.
///
-///\exception H5::IdComponentException when the attempt to close the HDF5
-/// object fails
+///\exception H5::IdComponentException when the attempt to close the HDF5
+/// object fails
// Description:
-// The underlaying reference counting in the C library ensures
-// that the current valid id of this object is properly closed.
-// Then the object's id is reset to the new id.
-// Programmer Binh-Minh Ribler - 2000
+// The underlaying reference counting in the C library ensures
+// that the current valid id of this object is properly closed.
+// Then the object's id is reset to the new id.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::p_setId(const hid_t new_id)
{
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index 06a5450..e88093e 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -24,10 +24,10 @@ namespace H5 {
//! Class FloatType operates on HDF5 floating point datatype.
class H5_DLLCPP FloatType : public AtomType {
public:
- // Creates a floating-point type using a predefined type
- FloatType( const PredType& pred_type );
+ // Creates a floating-point type using a predefined type.
+ FloatType( const PredType& pred_type );
- // Gets the floating-point datatype of the specified dataset
+ // Gets the floating-point datatype of the specified dataset.
FloatType( const DataSet& dataset );
// Retrieves the exponent bias of a floating-point type.
@@ -60,7 +60,7 @@ class H5_DLLCPP FloatType : public AtomType {
// Default constructor
FloatType();
- // Creates a floating-point datatype using an existing id
+ // Creates a floating-point datatype using an existing id.
FloatType( const hid_t existing_id );
// Copy constructor: makes a copy of the original FloatType object.
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 93ee4fd..60735f0 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -26,14 +26,19 @@
namespace H5 {
#endif
-// This flag controls whether H5Library::initH5cpp has been called to register
-// terminating functions with atexit()
+// This flag indicates whether H5Library::initH5cpp has been called to register
+// the terminating functions with atexit()
bool IdComponent::H5cppinit = false;
+
+// This flag is used to decide whether H5dont_atexit should be called.
+// Subclasses that have global constants use it. This is a temporary
+// work-around in 1.8.16. It will be removed after HDFFV-9540 is fixed.
bool IdComponent::H5dontAtexit_called = false;
//--------------------------------------------------------------------------
// Function: IdComponent overloaded constructor
-// Purpose Creates an IdComponent object using the id of an existing object.
+///\brief Creates an IdComponent object using the id of an existing
+/// object. - Obsolete, will be removed in 1.8.17
// Param h5_id - IN: Id of an existing object
// Exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
@@ -43,25 +48,10 @@ bool IdComponent::H5dontAtexit_called = false;
// been moved to the sub-classes. It will be removed in 1.10 release. If its
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
// subsequent releases.
-// - Removed from documentation in 1.8.16 -BMR (October 2015)
//--------------------------------------------------------------------------
IdComponent::IdComponent(const hid_t h5_id) {}
//--------------------------------------------------------------------------
-// Function: IdComponent copy constructor
-// Purpose: This noop copy constructor is removed as a result of the data
-// member "id" being moved down to sub-classes. (Mar 2015)
-// Parameters: original - IN: IdComponent instance to copy
-// Programmer Binh-Minh Ribler - 2000
-//
-// *** Deprecation warning ***
-// This constructor is no longer appropriate because the data member "id" had
-// been moved to the sub-classes. It is removed from 1.8.15 because it is
-// a noop and it can be generated by the compiler if needed.
-//--------------------------------------------------------------------------
-// IdComponent::IdComponent(const IdComponent& original) {}
-
-//--------------------------------------------------------------------------
// Function: IdComponent::incRefCount
///\brief Increment reference counter for a given id.
// Programmer Binh-Minh Ribler - May 2005
@@ -227,7 +217,7 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
//--------------------------------------------------------------------------
// Function: IdComponent::setId
///\brief Sets the identifier of this object to a new value.
-///
+///\param new_id - IN: New identifier to be set to
///\exception H5::IdComponentException when the attempt to close the HDF5
/// object fails
// Description:
@@ -242,8 +232,8 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
// C++ API object, which will be destroyed properly, and so
// p_setId does not call incRefCount. On the other hand, the
// public version setId is used by other applications, in which
-// the id passed to setId already has a reference count, so setId
-// must call incRefCount.
+// the id passed to setId is that of another C++ API object, so
+// setId must call incRefCount.
//--------------------------------------------------------------------------
void IdComponent::setId(const hid_t new_id)
{
@@ -295,10 +285,10 @@ H5std_string IdComponent::inMemFunc(const char* func_name) const
IdComponent::IdComponent()
{
// initH5cpp will register the terminating functions with atexit().
- // We only do this once.
+ // This should only be done once.
if (!H5cppinit)
{
- H5Library::getInstance()->initH5cpp();
+ H5Library::initH5cpp();
H5cppinit = true;
}
}
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 1c29f09..61c8bd6 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -17,6 +17,8 @@
#ifndef __IdComponent_H
#define __IdComponent_H
+// IdComponent represents an HDF5 object that has an identifier.
+
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
@@ -30,12 +32,7 @@ class DataSpace;
rarely needs them.
*/
class H5_DLLCPP IdComponent {
- public:
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- static bool H5cppinit;
- static bool H5dontAtexit_called;
-#endif // DOXYGEN_SHOULD_SKIP_THIS
+ public:
// Increment reference counter.
void incRefCount(const hid_t obj_id) const;
@@ -58,11 +55,6 @@ class H5_DLLCPP IdComponent {
// Assignment operator.
IdComponent& operator=( const IdComponent& rhs );
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Gets the identifier of this object.
- virtual hid_t getId () const = 0;
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
// Sets the identifier of this object to a new value.
void setId(const hid_t new_id);
@@ -76,10 +68,14 @@ class H5_DLLCPP IdComponent {
// Creates an object to hold an HDF5 identifier.
IdComponent( const hid_t h5_id );
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
// Copy constructor: makes copy of the original IdComponent object.
- // IdComponent( const IdComponent& original );
+ // IdComponent( const IdComponent& original ); - removed from 1.8.15
+
+ // Gets the identifier of this object.
+ virtual hid_t getId () const = 0;
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Pure virtual function for there are various H5*close for the
// subclasses.
virtual void close() = 0;
@@ -96,11 +92,12 @@ class H5_DLLCPP IdComponent {
// Destructor
virtual ~IdComponent();
- protected:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ protected:
// 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;
@@ -110,7 +107,14 @@ class H5_DLLCPP IdComponent {
// Sets the identifier of this object to a new value. - this one
// doesn't increment reference count
virtual void p_setId(const hid_t new_id) = 0;
- //virtual void p_setId(const hid_t new_id);
+
+ // This flag is used to decide whether H5dont_atexit should be called
+ static bool H5dontAtexit_called;
+
+ private:
+ // This flag indicates whether H5Library::initH5cpp has been called
+ // to register various terminating functions with atexit()
+ static bool H5cppinit;
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index e7e9fb6..40c766a 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -38,11 +38,14 @@ namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-H5Library* H5Library::instance = 0;
+
+// This static variable is unused, will be removed in future releases.
+bool H5Library::need_cleanup = false;
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Library::open
+// Function: H5Library::open (static)
///\brief Initializes the HDF5 library.
///
///\exception H5::LibraryIException
@@ -58,7 +61,7 @@ void H5Library::open()
}
//--------------------------------------------------------------------------
-// Function: H5Library::close
+// Function: H5Library::close (static)
///\brief Flushes all data to disk, closes files, and cleans up memory.
///
///\exception H5::LibraryIException
@@ -74,7 +77,7 @@ void H5Library::close()
}
//--------------------------------------------------------------------------
-// Function: H5Library::dontAtExit
+// Function: H5Library::dontAtExit (static)
///\brief Instructs library not to install the C \c atexit cleanup routine
///
///\exception H5::LibraryIException
@@ -89,7 +92,7 @@ void H5Library::dontAtExit()
}
//--------------------------------------------------------------------------
-// Function: H5Library::getLibVersion
+// Function: H5Library::getLibVersion (static)
///\brief Returns the HDF library release number.
///\param majnum - OUT: Major version of the library
///\param minnum - OUT: Minor version of the library
@@ -107,7 +110,7 @@ void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& rel
}
//--------------------------------------------------------------------------
-// Function: H5Library::checkVersion
+// Function: H5Library::checkVersion (static)
///\brief Verifies that the arguments match the version numbers
/// compiled into the library
///\param majnum - IN: Major version of the library
@@ -130,7 +133,7 @@ void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
}
//--------------------------------------------------------------------------
-// Function: H5Library::garbageCollect
+// Function: H5Library::garbageCollect (static)
///\brief Walks through all the garbage collection routines for the
/// library, which are supposed to free any unused memory they
/// have allocated.
@@ -159,7 +162,7 @@ void H5Library::garbageCollect()
}
//--------------------------------------------------------------------------
-// Function: H5Library::initH5cpp
+// Function: H5Library::initH5cpp (static)
///\brief Initializes C++ library and registers terminating functions at
/// exit. Only for the library functions, not for user-defined
/// functions.
@@ -167,52 +170,56 @@ void H5Library::garbageCollect()
// initH5cpp registers the following functions with std::atexit():
// termH5cpp() - calls H5close() after all cleanup in
// the C++ library is done
-// <classname>::deleteConstants - deletes all references for
-// <classname> global constants
+// <classname>::deleteConstants - deletes all references
+// for <classname> global constants
///\exception H5::LibraryIException
//
// Programmer Binh-Minh Ribler - September, 2015
//--------------------------------------------------------------------------
void H5Library::initH5cpp()
{
- // Register terminating functions with atexit(); they will be invoked in the
- // reversed order
+ // Register terminating functions with atexit(); they will be invoked in
+ // the reversed order
int ret_value = 0;
ret_value = std::atexit(termH5cpp);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of termH5cpp failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating termH5cpp failed");
ret_value = std::atexit(PredType::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of PredType::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating PredType::deleteConstants failed");
ret_value = std::atexit(PropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of PropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating PropList::deleteConstants failed");
ret_value = std::atexit(FileAccPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of FileAccPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating FileAccPropList::deleteConstants failed");
ret_value = std::atexit(FileCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of FileCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating FileCreatPropList::deleteConstants failed");
ret_value = std::atexit(DSetMemXferPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of DSetMemXferPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating DSetMemXferPropList::deleteConstants failed");
ret_value = std::atexit(DSetCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of DSetCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating DSetCreatPropList::deleteConstants failed");
+
+ ret_value = std::atexit(ObjCreatPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registrating ObjCreatPropList::deleteConstants failed");
ret_value = std::atexit(DataSpace::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registration of DataSpace::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp", "Registrating DataSpace::deleteConstants failed");
}
//--------------------------------------------------------------------------
-// Function: H5Library::termH5cpp
+// Function: H5Library::termH5cpp (static)
///\brief Sends request for the C layer to terminate.
///\par Description
/// If the C library fails to terminate, exit with a failure.
@@ -227,24 +234,7 @@ void H5Library::termH5cpp()
}
//--------------------------------------------------------------------------
-// Function: H5Library::getInstance
-///\brief Provides a way to instantiate the class.
-///\par Description
-/// getInstance ensures that only one instance of the H5Library
-/// is created.
-// Programmer Binh-Minh Ribler - September, 2015
-//--------------------------------------------------------------------------
-H5Library* H5Library::getInstance()
-{
- if (H5Library::instance == 0)
- {
- instance = new H5Library();
- }
- return(instance);
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Library::setFreeListLimits
+// Function: H5Library::setFreeListLimits (static)
///\brief Sets limits on the different kinds of free lists.
///\param reg_global_lim - IN: Limit on all "regular" free list memory used
///\param reg_list_lim - IN: Limit on memory used in each "regular" free list
@@ -271,10 +261,10 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
}
}
-// Default constructor - no instance ever created by outsiders
+// Default constructor - private
H5Library::H5Library(){};
-// Destructor
+// Destructor - private
H5Library::~H5Library(){};
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h
index 68ab039..336f9c8 100644
--- a/c++/src/H5Library.h
+++ b/c++/src/H5Library.h
@@ -29,6 +29,11 @@ namespace H5 {
*/
class H5_DLLCPP H5Library {
public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ static bool need_cleanup; // indicates if H5close should be called
+ // - unused, will be removed in future releases.
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
// Initializes the HDF5 library.
static void open();
@@ -60,15 +65,10 @@ class H5_DLLCPP H5Library {
// Sends request for terminating the HDF5 library.
static void termH5cpp(void);
- static H5Library* getInstance();
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
- // private instance to be created by H5Library only
- static H5Library* instance;
-
// Default constructor - no instance ever created from outsiders
H5Library();
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 79a8d5c..9e4ec05 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -150,9 +150,6 @@ class H5_DLLCPP H5Location : public IdComponent {
// Creates a copy of an existing object giving the location id.
H5Location(const hid_t loc_id);
- // Copy constructor.
- // H5Location(const H5Location& original);
-
// 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;
diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h
index be04451..7f6ee31 100644
--- a/c++/src/H5PropList.h
+++ b/c++/src/H5PropList.h
@@ -127,6 +127,9 @@ class H5_DLLCPP PropList : public IdComponent {
// Dynamically allocates the PropList global constant
static PropList* getConstant();
+ // Friend function to set PropList id. For library use only.
+ friend void f_PropList_setId(PropList* plist, hid_t new_id);
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c
index 4801f7d..9e3ddc4 100644
--- a/fortran/src/H5Of.c
+++ b/fortran/src/H5Of.c
@@ -901,13 +901,19 @@ h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size,
if((c_bufsize = H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0)
HGOTO_DONE(FAIL);
+ if(c_name)
+ HDfree(c_name);
+
*bufsize = (size_t_f)c_bufsize;
/*
* Convert C name to FORTRAN and place it in the given buffer
*/
- if(c_comment)
+ if(c_comment) {
HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1);
+ HDfree(c_comment);
+ }
+
return ret_value;
done:
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index b6389258..9928d0a 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -2421,7 +2421,10 @@ h5tenum_insert_ptr_c(hid_t_f *type_id, _fcd name, int_f* namelen, void *value)
if (c_name == NULL) return ret_value;
status = H5Tenum_insert( (hid_t)*type_id, c_name, value);
+
+ HDfree(c_name);
if ( status < 0 ) return ret_value;
+
ret_value = 0;
return ret_value;
}
diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y
index 4c07533..9f08254 100644
--- a/hl/src/H5LTparse.y
+++ b/hl/src/H5LTparse.y
@@ -190,7 +190,10 @@ memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify le
H5Tinsert(dtype_id, $<sval>4, $<ival>6, $<hid>1);
}
}
-
+ if($<sval>4) {
+ free($<sval>4);
+ $<sval>4 = NULL;
+ }
cmpd_stack[csindex].is_field = 0;
H5Tclose($<hid>1);
@@ -199,7 +202,9 @@ memb_def : ddl_type { cmpd_stack[csindex].is_field = 1; /*notify le
;
field_name : STRING
{
- $<sval>$ = yylval.sval;
+ $<sval>$ = strdup(yylval.sval);
+ free(yylval.sval);
+ yylval.sval = NULL;
}
;
field_offset : /*empty*/
@@ -247,6 +252,8 @@ opaque_type : H5T_OPAQUE_TOKEN
OPQ_TAG_TOKEN { is_opq_tag = 1; } '"' opaque_tag '"' ';'
{
H5Tset_tag($<hid>7, yylval.sval);
+ free(yylval.sval);
+ yylval.sval = NULL;
is_opq_tag = 0;
}
'}' { $<hid>$ = $<hid>7; }
@@ -335,6 +342,8 @@ enum_def : '"' enum_symbol '"' {
#else /* H5_HAVE_WIN32_API */
enum_memb_symbol = strdup(yylval.sval);
#endif /* H5_HAVE_WIN32_API */
+ free(yylval.sval);
+ yylval.sval = NULL;
}
enum_val ';'
{
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 9d625e9..f3258d6 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -1282,6 +1282,7 @@ static int test_strings(void)
HDfree(dt_str);
goto out;
}
+ HDfree(dt_str);
/* Length of the character buffer is smaller then needed */
str_len = 21;
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index d7d45e0..71b7194 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -975,6 +975,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE);
/* Encode driver-specific data */
+ HDmemset(dbuf, 0, sizeof(dbuf));
if(H5FD_sb_encode(f->shared->lf, info.name, dbuf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information")
diff --git a/src/H5G.c b/src/H5G.c
index a9be5b8..c08c823 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -594,7 +594,7 @@ H5G_get_create_plist(H5G_t *grp)
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline")
/* Set the pipeline for the property list */
- if(H5P_set(new_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
+ if(H5P_poke(new_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link pipeline")
} /* end if */
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 873b952..133b47f 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -626,7 +626,7 @@ Test Whether the Displacement of MPI derived datatype
and this platform.
1. Details for the test:
-1) Create two derived datatypes with MPI_Type_hindexed:
+1) Create two derived datatypes with MPI_Type_create_hindexed:
datatype1:
count = 1, blocklens = 1, offsets = 0,
base type = MPI_BYTE(essentially a char)
@@ -635,7 +635,7 @@ and this platform.
base type = MPI_BYTE
2) Using these two derived datatypes,
- Build another derived datatype with MPI_Type_struct:
+ Build another derived datatype with MPI_Type_create_struct:
advtype: derived from datatype1 and datatype2
advtype:
count = 2, blocklens[0] = 1, blocklens[1]=1,
@@ -716,7 +716,7 @@ static int test_mpio_derived_dtype(char *filename) {
blocklens[0] = 1;
offsets[0] = 0;
- if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype))
+ if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype))
!= MPI_SUCCESS){
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
@@ -732,7 +732,7 @@ static int test_mpio_derived_dtype(char *filename) {
count = 1;
blocklens[0]=1;
offsets[0] = 1;
- if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew))
+ if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew))
!= MPI_SUCCESS){
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
@@ -753,10 +753,10 @@ static int test_mpio_derived_dtype(char *filename) {
bas_filetype[0] = filetype;
bas_filetype[1] = filetypenew;
- if((mpi_err= MPI_Type_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype))
+ if((mpi_err= MPI_Type_create_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype))
!= MPI_SUCCESS){
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_struct failed (%s)\n", mpi_err_str);
+ printf("MPI_Type_create_struct failed (%s)\n", mpi_err_str);
return 1;
}
if((mpi_err=MPI_Type_commit(&adv_filetype))!=MPI_SUCCESS){
@@ -843,7 +843,7 @@ has no contribution to IO. To properly test this case, at least FOUR
processes are needed.
1. Details for the test:
-1) Create one derived datatype with MPI_Type_hindexed:
+1) Create one derived datatype with MPI_Type_create_hindexed:
2) Choosing at least two processes to contribute none for IO with
the buf size inside MPI_Write_at_all to 0.
@@ -899,7 +899,7 @@ test_mpio_special_collective(char *filename)
offsets[1] = (mpi_size+mpi_rank)*count;
if(count !=0) {
- if((mpi_err = MPI_Type_hindexed(2,
+ if((mpi_err = MPI_Type_create_hindexed(2,
blocklens,
offsets,
etype,
@@ -915,7 +915,7 @@ test_mpio_special_collective(char *filename)
return 1;
} /* end if */
- if((mpi_err = MPI_Type_hindexed(2,
+ if((mpi_err = MPI_Type_create_hindexed(2,
blocklens,
offsets,
etype,
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 6474082..190343b 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -334,8 +334,8 @@ hsize_t diff_attr(hid_t loc1_id,
size_t msize2; /* memory size of memory type */
void *buf1=NULL; /* data buffer */
void *buf2=NULL; /* data buffer */
- int buf1hasdata=0; /* buffer has data */
- int buf2hasdata=0; /* buffer has data */
+ hbool_t buf1hasdata=FALSE; /* buffer has data */
+ hbool_t buf2hasdata=FALSE; /* buffer has data */
hsize_t nelmts1; /* number of elements in dataset */
int rank1; /* rank of dataset */
int rank2; /* rank of dataset */
@@ -472,12 +472,12 @@ hsize_t diff_attr(hid_t loc1_id,
parallel_print("Failed reading attribute1 %s/%s\n", path1, name1);
goto error;
}else
- buf1hasdata = 1;
+ buf1hasdata = TRUE;
if(H5Aread(attr2_id,mtype2_id,buf2) < 0){
parallel_print("Failed reading attribute2 %s/%s\n", path2, name2);
goto error;
}else
- buf2hasdata = 1;
+ buf2hasdata = TRUE;
/* format output string */
HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);