mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
[svn-r26737] Purpose: Fix daily test failure
Description: - In DataType::DataType(const PredType& pred_type), using DataType::copy will invoke DataType::close() unnecessarily, which will produce undefined behavior. Changed to call H5Tcopy directly, code reuse is not useful in this case. - Also, fixed CommonFG::childObjVersion to return expected value outside of an if/else block. Platforms tested: Linux/ppc64 (ostrich) Linux/64 (platypus) Linux/32 2.6 (jam)
This commit is contained in:
parent
b9e5e2af4e
commit
4275900a7b
@ -1130,6 +1130,7 @@ H5O_type_t CommonFG::childObjType(hsize_t index, H5_index_t index_type, H5_iter_
|
||||
unsigned CommonFG::childObjVersion(const char* objname) const
|
||||
{
|
||||
H5O_info_t objinfo;
|
||||
unsigned version = 0;
|
||||
|
||||
// Use C API to get information of the object
|
||||
herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
|
||||
@ -1140,12 +1141,11 @@ unsigned CommonFG::childObjVersion(const char* objname) const
|
||||
// Return a valid version or throw an exception for invalid value
|
||||
else
|
||||
{
|
||||
unsigned version = objinfo.hdr.version;
|
||||
version = objinfo.hdr.version;
|
||||
if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
|
||||
throwException("childObjVersion", "Invalid version for object");
|
||||
else
|
||||
return(version);
|
||||
}
|
||||
return(version);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -21,6 +21,7 @@
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// Class forwarding
|
||||
class Group;
|
||||
class H5File;
|
||||
class ArrayType;
|
||||
|
@ -106,7 +106,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object()
|
||||
// Jul, 2008
|
||||
// Added for application convenience.
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
|
||||
DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object()
|
||||
{
|
||||
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
|
||||
}
|
||||
@ -148,13 +148,18 @@ DataType::DataType(const DataType& original) : H5Object()
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Description
|
||||
// This is so that when a predefined type is passed in, a
|
||||
// copy of it is made, not just a duplicate of the HDF5 id.
|
||||
// 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.
|
||||
// Note: calling DataType::copy will invoke DataType::close()
|
||||
// unnecessarily and will produce undefined behavior.
|
||||
// -BMR, Apr 2015
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(const PredType& pred_type) : H5Object()
|
||||
{
|
||||
// use DataType::copy to make a copy of this predefined type
|
||||
copy(pred_type);
|
||||
// call C routine to copy the datatype
|
||||
id = H5Tcopy( pred_type.getId() );
|
||||
if (id < 0)
|
||||
throw DataTypeIException("DataType constructor", "H5Tcopy failed");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user