diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2014-03-23 21:30:43 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2014-03-23 21:30:43 (GMT) |
commit | 74079aa0de09be6c57244bb4d33fcda51f7a2f4c (patch) | |
tree | ccce4a37a0a538d1a8871a3d2828e7f1f30746e4 /c++/src/H5EnumType.cpp | |
parent | e18ee63c5a5c294d1949d83b1d34ae1fe15086ae (diff) | |
download | hdf5-74079aa0de09be6c57244bb4d33fcda51f7a2f4c.zip hdf5-74079aa0de09be6c57244bb4d33fcda51f7a2f4c.tar.gz hdf5-74079aa0de09be6c57244bb4d33fcda51f7a2f4c.tar.bz2 |
[svn-r24870] Description:
- Added another overload for char* argument:
ssize_t getComment(const char* name, const size_t buf_size, char* comment)
- Changed default value to 0 for the other two getComment methods
- Added HDmemset to after every char string allocation to clear the buffer
- Added a null terminator to the comment returned from the C call, in
getComment methods
- Some minor cleanup
Merged from trunk: -r24865 -r24867
Platforms tested:
Linux/ppc64 (ostrich)
Linux/32 2.6 (jam)
SunOS 5.11 (emu)
Diffstat (limited to 'c++/src/H5EnumType.cpp')
-rw-r--r-- | c++/src/H5EnumType.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index ff632af..04bb9e0 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -30,6 +30,7 @@ #include "H5AtomType.h" #include "H5IntType.h" #include "H5EnumType.h" +#include "H5private.h" // for HDmemset #ifndef H5_NO_NAMESPACE namespace H5 { @@ -150,6 +151,7 @@ void EnumType::insert( const H5std_string& name, void *value ) const H5std_string EnumType::nameOf( void *value, size_t size ) const { char* name_C = new char[size+1]; // temporary C-string for C API + HDmemset(name_C, 0, size+1); // clear buffer // Calls C routine H5Tenum_nameof to get the name of the specified enum type herr_t ret_value = H5Tenum_nameof( id, value, name_C, size ); @@ -160,7 +162,7 @@ H5std_string EnumType::nameOf( void *value, size_t size ) const throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed"); } // otherwise, create the string to hold the datatype name and return it - H5std_string name = H5std_string(name_C); + H5std_string name(name_C); delete []name_C; return( name ); } |