summaryrefslogtreecommitdiffstats
path: root/c++/src/H5EnumType.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2014-03-21 23:23:05 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2014-03-21 23:23:05 (GMT)
commit60df159d33d8793dd5764e2ae032e0e89fc44c9b (patch)
tree8a83268f8ee902901d982d33b380568a2962f9ab /c++/src/H5EnumType.cpp
parent2e4302818ab260604ffa26e90dab159cf28079d4 (diff)
downloadhdf5-60df159d33d8793dd5764e2ae032e0e89fc44c9b.zip
hdf5-60df159d33d8793dd5764e2ae032e0e89fc44c9b.tar.gz
hdf5-60df159d33d8793dd5764e2ae032e0e89fc44c9b.tar.bz2
[svn-r24865] 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 Platforms tested: Linux/ppc64 (ostrich) Linux/32 2.6 (jam) Linux/64 2.6 (platypus)/PGI compilers
Diffstat (limited to 'c++/src/H5EnumType.cpp')
-rw-r--r--c++/src/H5EnumType.cpp4
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 );
}