[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)
This commit is contained in:
@@ -50,7 +50,7 @@ namespace H5 {
|
||||
///\brief Default constructor: creates a stub H5File object.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
H5File::H5File() : H5Location(), id(0) {}
|
||||
H5File::H5File() : H5Location(), id(H5I_INVALID_HID) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File overloaded constructor
|
||||
@@ -86,7 +86,7 @@ H5File::H5File() : H5Location(), id(0) {}
|
||||
// to catch then re-throw it. -BMR 2013/03/21
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0)
|
||||
H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(H5I_INVALID_HID)
|
||||
{
|
||||
try {
|
||||
p_get_file(name, flags, create_plist, access_plist);
|
||||
@@ -111,7 +111,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
|
||||
// to catch then re-throw it. -BMR 2013/03/21
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(0)
|
||||
H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), id(H5I_INVALID_HID)
|
||||
{
|
||||
try {
|
||||
p_get_file(name.c_str(), flags, create_plist, access_plist);
|
||||
@@ -604,7 +604,7 @@ void H5File::close()
|
||||
throw FileIException("H5File::close", "H5Fclose failed");
|
||||
}
|
||||
// reset the id
|
||||
id = 0;
|
||||
id = H5I_INVALID_HID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user