summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataSet.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2014-03-23 21:30:43 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2014-03-23 21:30:43 (GMT)
commit74079aa0de09be6c57244bb4d33fcda51f7a2f4c (patch)
treeccce4a37a0a538d1a8871a3d2828e7f1f30746e4 /c++/src/H5DataSet.cpp
parente18ee63c5a5c294d1949d83b1d34ae1fe15086ae (diff)
downloadhdf5-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/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 1a26045..7f2f152 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 )