summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataSet.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/H5DataSet.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/H5DataSet.cpp')
-rw-r--r--c++/src/H5DataSet.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 0722ef9..699f982 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -629,7 +629,7 @@ hid_t DataSet::getId() const
//--------------------------------------------------------------------------
// Function: DataSet::p_read_fixed_len (private)
-// brief Reads a fixed length \a H5std_string from an dataset.
+// brief Reads a fixed length \a H5std_string from a dataset.
// param mem_type - IN: DataSet datatype (in memory)
// param strg - IN: Buffer for read string
// exception H5::DataSetIException
@@ -643,14 +643,14 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id
// Only allocate for fixed-len string.
// Get the size of the dataset's data
- size_t attr_size = getInMemDataSize();
+ size_t data_size = getInMemDataSize();
// If there is data, allocate buffer and read it.
- if (attr_size > 0)
+ if (data_size > 0)
{
- char *strg_C = NULL;
+ char *strg_C = new char [data_size+1];
+ HDmemset(strg_C, 0, data_size+1); // clear buffer
- strg_C = new char [(size_t)attr_size+1];
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
if( ret_value < 0 )