diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-06-23 03:42:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 03:42:02 (GMT) |
commit | cc88fe8fafa0a522ba583bf75b2fe9a15688db9c (patch) | |
tree | 322f12e7ebe3cd900ec65486466991ebdf48ea94 /c++/src/H5Location.cpp | |
parent | 3d4481c2920b7b983a8d791a266cd2bc9c96e846 (diff) | |
download | hdf5-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/H5Location.cpp')
-rw-r--r-- | c++/src/H5Location.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index bb754a2..eb8dd4c 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -15,7 +15,6 @@ #include <iostream> using namespace std; -#include "H5private.h" // for HDmemset #include "H5Include.h" #include "H5Exception.h" #include "H5IdComponent.h" @@ -367,8 +366,7 @@ H5Location::getComment(const char *name, size_t buf_size) const tmp_len = comment_len; // Temporary buffer for char* comment - char *comment_C = new char[tmp_len + 1]; - HDmemset(comment_C, 0, tmp_len + 1); // clear buffer + char *comment_C = new char[tmp_len + 1](); // Used overloaded function ssize_t temp_len = getComment(name, tmp_len + 1, comment_C); @@ -1835,8 +1833,8 @@ H5Location::getLinkval(const char *name, size_t size) const // if link has value, retrieve the value, otherwise, return null string if (val_size > 0) { - value_C = new char[val_size + 1]; // temporary C-string for C API - HDmemset(value_C, 0, val_size + 1); // clear buffer + // Create buffer for C string + value_C = new char[val_size + 1](); ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT); if (ret_value < 0) { @@ -2046,9 +2044,8 @@ H5Location::getObjnameByIdx(hsize_t idx) const if (name_len < 0) throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - // now, allocate C buffer to get the name - char *name_C = new char[name_len + 1]; - HDmemset(name_C, 0, name_len + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[name_len + 1](); name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len + 1, H5P_DEFAULT); @@ -2102,8 +2099,8 @@ H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const { - char *name_C = new char[size + 1]; // temporary C-string for object name - HDmemset(name_C, 0, size + 1); // clear buffer + // Create buffer for C string + char *name_C = new char[size + 1](); // call overloaded function to get the name ssize_t name_len = getObjnameByIdx(idx, name_C, size + 1); |