summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Attribute.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2014-09-30 18:20:36 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2014-09-30 18:20:36 (GMT)
commit10f1e6acf8916a429f2cc925f49518cfc0015b6c (patch)
treef6078e3ae7987d9eb9737cfc1e8f3dc0e7f005b9 /c++/src/H5Attribute.cpp
parent0befe65753b60e85891453dcbca373763a070419 (diff)
downloadhdf5-10f1e6acf8916a429f2cc925f49518cfc0015b6c.zip
hdf5-10f1e6acf8916a429f2cc925f49518cfc0015b6c.tar.gz
hdf5-10f1e6acf8916a429f2cc925f49518cfc0015b6c.tar.bz2
[svn-r25640] Purpose: Fixed HDFFV-4259
Description: - Used H5I_INVALID_HID instead of 0 to initialized member "id" in classes that represent HDF5 objects. For PropList, H5P_DEFAULT has to be used instead of H5I_INVALID_HID. - Added try/catch block to some dynamically allocating memory code and re-throw the bad_alloc exception with a message informing the location of the failure. Platforms tested: Linux/ppc64 (ostrich) Linux/32 2.6 (jam) SunOS 5.11 (emu)
Diffstat (limited to 'c++/src/H5Attribute.cpp')
-rw-r--r--c++/src/H5Attribute.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index bdd0ac0..a9e928d 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -50,7 +50,7 @@ class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
///\brief Default constructor: Creates a stub attribute
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-Attribute::Attribute() : AbstractDs(), IdComponent(), id(0) {}
+Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: Attribute copy constructor
@@ -162,13 +162,13 @@ void Attribute::read( const DataType& mem_type, void *buf ) const
// Mar 2008
// Corrected a misunderstanding that H5Aread would allocate
// space for the buffer. Obtained the attribute size and
-// allocated memory properly. - BMR
+// allocated memory properly. -BMR
// Apr 2009
-// Used getInMemDataSize to get attribute data size. - BMR
+// Used getInMemDataSize to get attribute data size. -BMR
// Jul 2009
// Divided into specific private functions for fixed- and
// variable-len string data: p_read_fixed_len and
-// p_read_variable_len. This should improve readability.
+// p_read_variable_len. This should improve readability. -BMR
//--------------------------------------------------------------------------
void Attribute::read(const DataType& mem_type, H5std_string& strg) const
{
@@ -586,7 +586,7 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c
// Modification
// Jul 2009
// Separated the variable length case from the original
-// Attribute::read
+// Attribute::read. -BMR
//--------------------------------------------------------------------------
void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const
{
@@ -650,7 +650,7 @@ void Attribute::close()
throw AttributeIException("Attribute::close", "H5Aclose failed");
}
// reset the id
- id = 0;
+ id = H5I_INVALID_HID;
}
}