summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataType.cpp
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-06-23 03:42:02 (GMT)
committerGitHub <noreply@github.com>2021-06-23 03:42:02 (GMT)
commitcc88fe8fafa0a522ba583bf75b2fe9a15688db9c (patch)
tree322f12e7ebe3cd900ec65486466991ebdf48ea94 /c++/src/H5DataType.cpp
parent3d4481c2920b7b983a8d791a266cd2bc9c96e846 (diff)
downloadhdf5-cc88fe8fafa0a522ba583bf75b2fe9a15688db9c.zip
hdf5-cc88fe8fafa0a522ba583bf75b2fe9a15688db9c.tar.gz
hdf5-cc88fe8fafa0a522ba583bf75b2fe9a15688db9c.tar.bz2
Removes C++ dependency on H5private.h (#774)
* Removes C++ dependency on H5private.h Most C API calls have been removed, aside from a few uses of free, where we just dropped the 'HD'. A couple of H5_ATTR_UNUSED macros were also replaced with (void) statements. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'c++/src/H5DataType.cpp')
-rw-r--r--c++/src/H5DataType.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index cdf28cf..b00a526 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -32,7 +32,6 @@
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5PredType.h"
-#include "H5private.h"
#include "H5AbstractDs.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
@@ -316,8 +315,9 @@ DataType::encode()
// Allocate buffer and call C function again to encode
if (buf_size > 0) {
- encoded_buf = static_cast<unsigned char *>(HDcalloc(1, buf_size));
- ret_value = H5Tencode(id, encoded_buf, &buf_size);
+ encoded_buf = new unsigned char[buf_size]();
+
+ ret_value = H5Tencode(id, encoded_buf, &buf_size);
if (ret_value < 0) {
throw DataTypeIException("DataType::encode", "H5Tencode failed");
}
@@ -970,7 +970,7 @@ DataType::close()
// Free and reset buffer of encoded object description if it's been used
if (encoded_buf != NULL) {
- HDfree(encoded_buf);
+ delete[] encoded_buf;
buf_size = 0;
}
}