diff options
Diffstat (limited to 'c++/src/H5DataSet.cpp')
-rw-r--r-- | c++/src/H5DataSet.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 47031db..53e8166 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -11,10 +11,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include <cstdlib> +#include <cstring> #include <iostream> #include <string> -#include "H5private.h" // for HDfree #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -717,8 +718,9 @@ DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, con // If there is data, allocate buffer and read it. if (data_size > 0) { + // Create buffer for C string char *strg_C = new char[data_size + 1]; - HDmemset(strg_C, 0, data_size + 1); // clear buffer + memset(strg_C, 0, data_size + 1); herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); @@ -759,7 +761,7 @@ DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, // Get string from the C char* and release resource allocated by C API strg = strg_C; - HDfree(strg_C); + free(strg_C); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -770,7 +772,7 @@ DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, ///\exception H5::IdComponentException when the attempt to close the HDF5 /// object fails // Description: -// The underlaying reference counting in the C library ensures +// The underlying reference counting in the C library ensures // that the current valid id of this object is properly closed. // Then the object's id is reset to the new id. //-------------------------------------------------------------------------- |