From 87a59c6f1cd9a24006ea6fbaf9835797176b63e3 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 14 Jul 2004 00:11:52 -0500 Subject: [svn-r8872] Purpose: Fixing bug Description: DataType::commit had incorrect parameter, H5Object. Changed it to CommonFG, for H5File and Group. The change caused additional header files needed for several other cpp files. Platforms tested: SunOS 5.7 (arabica) Linux 2.4 (eirene) Windows XP Misc. update: --- c++/src/H5AbstractDs.cpp | 2 ++ c++/src/H5AtomType.cpp | 2 ++ c++/src/H5Attribute.cpp | 15 ++++++++++++--- c++/src/H5CompType.cpp | 2 ++ c++/src/H5Cpp.h | 4 ++-- c++/src/H5DataSet.cpp | 3 ++- c++/src/H5DataType.cpp | 8 +++++--- c++/src/H5DataType.h | 4 ++-- c++/src/H5DcreatProp.cpp | 3 ++- c++/src/H5EnumType.cpp | 2 ++ c++/src/H5FloatType.cpp | 2 ++ c++/src/H5IntType.cpp | 2 ++ c++/src/H5PredType.cpp | 2 ++ c++/src/H5StrType.cpp | 2 ++ 14 files changed, 41 insertions(+), 12 deletions(-) diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 185ce7c..57488b9 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -21,6 +21,8 @@ #include "H5PropList.h" #include "H5Object.h" #include "H5AbstractDs.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5Alltypes.h" #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 2ca0188..993b1ca 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -20,6 +20,8 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5AtomType.h" diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 7e60650..60c541e 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -28,6 +28,8 @@ #include "H5Object.h" #include "H5AbstractDs.h" #include "H5Attribute.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5DataSpace.h" @@ -203,7 +205,7 @@ ssize_t Attribute::getName( size_t buf_size, string& attr_name ) const { throw AttributeIException("Attribute::getName", "H5Aget_name failed"); } - // otherwise, convert the C string attribute name and return + // otherwise, convert the C attribute name and return attr_name = name_C; delete name_C; return( name_size ); @@ -241,12 +243,19 @@ string Attribute::getName() const // Try with 256 characters for the name first, if the name's length // returned is more than that then, read the name again with the // appropriate space allocation + char* name_C = new char[256]; // temporary C-string for C API + ssize_t name_size = H5Aget_name(id, 255, name_C); + string attr_name; - ssize_t name_size = getName(255, attr_name); if (name_size >= 256) name_size = getName(name_size, attr_name); + + // otherwise, convert the C attribute name and return + else + attr_name = name_C; + + delete name_C; return( attr_name ); - // let caller catch exception if any } //-------------------------------------------------------------------------- diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index cbfafb6..394ce18 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -20,6 +20,8 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5Alltypes.h" #include "H5AbstractDs.h" #include "H5DxferProp.h" diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h index 92f0a33..7f80a3c 100644 --- a/c++/src/H5Cpp.h +++ b/c++/src/H5Cpp.h @@ -25,8 +25,9 @@ #include "H5Object.h" #include "H5AbstractDs.h" #include "H5Attribute.h" -#include "H5DataType.h" #include "H5DcreatProp.h" +#include "H5CommonFG.h" +#include "H5DataType.h" #include "H5DxferProp.h" #include "H5FaccProp.h" #include "H5FcreatProp.h" @@ -38,7 +39,6 @@ #include "H5StrType.h" #include "H5CompType.h" #include "H5DataSet.h" -#include "H5CommonFG.h" #include "H5Group.h" #include "H5File.h" #include "H5Library.h" diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 602d9e4..254138e 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -28,8 +28,9 @@ #include "H5Object.h" #include "H5PropList.h" #include "H5DxferProp.h" -#include "H5DataType.h" #include "H5DcreatProp.h" +#include "H5CommonFG.h" +#include "H5DataType.h" #include "H5DataSpace.h" #include "H5AbstractDs.h" #include "H5DataSet.h" diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 28b2cda..d1cb1ee 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -27,6 +27,8 @@ #include "H5PropList.h" #include "H5DataSpace.h" #include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5AtomType.h" #include "H5PredType.h" @@ -169,9 +171,9 @@ bool DataType::operator==(const DataType& compared_type ) const // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- // Commits a transient datatype to a file, creating a new named datatype -void DataType::commit( H5Object& loc, const char* name ) const +void DataType::commit( CommonFG& loc, const char* name ) const { - hid_t loc_id = loc.getId(); // get location id for C API + hid_t loc_id = loc.getLocId(); // get location id for C API // Call C routine to commit the transient datatype herr_t ret_value = H5Tcommit( loc_id, name, id ); @@ -187,7 +189,7 @@ void DataType::commit( H5Object& loc, const char* name ) const /// argument \a name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataType::commit( H5Object& loc, const string& name ) const +void DataType::commit( CommonFG& loc, const string& name ) const { commit( loc, name.c_str() ); } diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 3f695ff..fa288d7 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -36,8 +36,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( H5Object& loc, const string& name ) const; - void commit( H5Object& loc, const char* name ) const; + void commit( CommonFG& loc, const string& name ) const; + void commit( CommonFG& loc, const char* name ) const; // Determines whether this datatype is a named datatype or // a transient datatype. diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 66a2862..d2a74f4 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -20,8 +20,9 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5Object.h" -#include "H5DataType.h" #include "H5DcreatProp.h" +#include "H5CommonFG.h" +#include "H5DataType.h" #ifndef H5_NO_NAMESPACE namespace H5 { diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 8567a6d..0421707 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -23,6 +23,8 @@ #include "H5AbstractDs.h" #include "H5DxferProp.h" #include "H5DataSpace.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5DataSet.h" #include "H5AtomType.h" diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp index 010d8a3..0401718 100644 --- a/c++/src/H5FloatType.cpp +++ b/c++/src/H5FloatType.cpp @@ -20,6 +20,8 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5AbstractDs.h" #include "H5DxferProp.h" diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp index 3986b3b..a6d17e0 100644 --- a/c++/src/H5IntType.cpp +++ b/c++/src/H5IntType.cpp @@ -20,6 +20,8 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5AbstractDs.h" #include "H5DxferProp.h" diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index cba7a58..e951675 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -20,6 +20,8 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5AtomType.h" #include "H5Library.h" diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index 1961365..d213841 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -20,6 +20,8 @@ #include "H5IdComponent.h" #include "H5PropList.h" #include "H5Object.h" +#include "H5DcreatProp.h" +#include "H5CommonFG.h" #include "H5DataType.h" #include "H5AtomType.h" #include "H5AbstractDs.h" -- cgit v0.12