diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-07-11 15:59:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-11 15:59:51 (GMT) |
commit | fa7caf843508b250f085e88cf5edfc2606da1205 (patch) | |
tree | 8ecc6f13d62952ab8ee49ea59bae9c2a47684e9b /c++/src/H5ArrayType.cpp | |
parent | f599e2ac7fb7fb146b49e2f349a9c100e897f7ef (diff) | |
download | hdf5-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/H5ArrayType.cpp')
-rw-r--r-- | c++/src/H5ArrayType.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 6999f1b..953c355 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -70,8 +70,11 @@ ArrayType::ArrayType(const ArrayType &original) : DataType(original) //-------------------------------------------------------------------------- ArrayType::ArrayType(const DataType &base_type, int ndims, const hsize_t *dims) : DataType() { + if (ndims < 0 || ndims > H5S_MAX_RANK) + throw DataTypeIException("ArrayType constructor", "ndims not in range [0..H5S_MAX_RANK]"); + // Call C API to create an array data type - hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims); + hid_t new_type_id = H5Tarray_create2(base_type.getId(), static_cast<unsigned>(ndims), dims); if (new_type_id < 0) throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed"); |