diff options
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 ); } |