summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DxferProp.cpp
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-07-11 15:59:51 (GMT)
committerGitHub <noreply@github.com>2022-07-11 15:59:51 (GMT)
commitfa7caf843508b250f085e88cf5edfc2606da1205 (patch)
tree8ecc6f13d62952ab8ee49ea59bae9c2a47684e9b /c++/src/H5DxferProp.cpp
parentf599e2ac7fb7fb146b49e2f349a9c100e897f7ef (diff)
downloadhdf5-fa7caf843508b250f085e88cf5edfc2606da1205.zip
hdf5-fa7caf843508b250f085e88cf5edfc2606da1205.tar.gz
hdf5-fa7caf843508b250f085e88cf5edfc2606da1205.tar.bz2
Fixes C++ sign-conversion warnings w/ clang 14 (#1870)
* Fixes sign-conversion warnings w/ clang 14 * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'c++/src/H5DxferProp.cpp')
-rw-r--r--c++/src/H5DxferProp.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 1fd6878..ccb49be 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -322,11 +322,16 @@ DSetMemXferPropList::getDataTransform() const
// If expression exists, calls C routine again to get it
else if (exp_len > 0) {
+
+ // The actual size is the cast value + 1 for the terminal ASCII NUL
+ // (unfortunate in/out type sign mismatch)
+ size_t actual_exp_len = static_cast<size_t>(exp_len) + 1;
+
// Temporary buffer for char* expression
- char *exp_C = new char[exp_len + 1]();
+ char *exp_C = new char[actual_exp_len]();
// Used overloaded function
- exp_len = getDataTransform(exp_C, exp_len + 1);
+ exp_len = getDataTransform(exp_C, actual_exp_len);
// Convert the C expression to return
expression = exp_C;