diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2010-05-02 14:25:42 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2010-05-02 14:25:42 (GMT) |
commit | ec68ca2481baa02549f63883cc1537ff804379f4 (patch) | |
tree | 285e38befd8b4a4f74ae71e00baec9021c7ba22c /c++/src | |
parent | ad4f1dc17df4afa178a971d88a5b2c1ab321f230 (diff) | |
download | hdf5-ec68ca2481baa02549f63883cc1537ff804379f4.zip hdf5-ec68ca2481baa02549f63883cc1537ff804379f4.tar.gz hdf5-ec68ca2481baa02549f63883cc1537ff804379f4.tar.bz2 |
[svn-r18682] Description:
Purpose: Fix bugzilla 1857
Added missing overloaded function getObjnameByIdx to take char* for name.
Platforms tested:
Linux/32 2.6 (jam)
FreeBSD/64 6.3 (liberty)
SunOS 5.10 (linew)
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5CommonFG.cpp | 19 | ||||
-rw-r--r-- | c++/src/H5CommonFG.h | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 8c1237d..2772903 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -1058,10 +1058,27 @@ H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const /// each time the group is opened. // Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- +ssize_t CommonFG::getObjnameByIdx(hsize_t idx, char* name, size_t size) const +{ + ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT); + if(name_len < 0) + { + throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); + } + return (name_len); +} + +//-------------------------------------------------------------------------- +// Function: CommonFG::getObjnameByIdx +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes an +/// \c std::string for \a name. +// Programmer Binh-Minh Ribler - January, 2003 +//-------------------------------------------------------------------------- ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const { char* name_C = new char[size]; - ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, size, H5P_DEFAULT); + ssize_t name_len = getObjnameByIdx(idx, name_C, size); if(name_len < 0) { throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index d472d42..75c9259 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -70,8 +70,9 @@ class H5_DLLCPP CommonFG { // Retrieves the name of an object in this group, given the // object's index. - ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const; H5std_string getObjnameByIdx(hsize_t idx) const; + ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const; + ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const; #ifndef H5_NO_DEPRECATED_SYMBOLS // Returns the type of an object in this group, given the |