Skip to content

Commit

Permalink
Fix bug in enforce_ascii_hack.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Nov 21, 2023
1 parent fc2ef4a commit 877a76e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/highfive/bits/H5ReadWrite_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,14 @@ inline void enforce_ascii_hack(const DataType& dst, const DataType& src) {
// TEMP. CHANGE: Ensure that the character set is properly configured to prevent
// converter issues on HDF5 <=v1.12.0 when loading ASCII strings first.
// See https://github.com/HDFGroup/hdf5/issues/544 for further information.
if (H5Tget_cset(src.getId()) == H5T_CSET_ASCII) {
H5Tset_cset(dst.getId(), H5T_CSET_ASCII);

bool is_dst_string = H5Tget_class(dst.getId()) == H5T_STRING;
bool is_src_string = H5Tget_class(src.getId()) == H5T_STRING;

if (is_dst_string && is_src_string) {
if (H5Tget_cset(src.getId()) == H5T_CSET_ASCII) {
H5Tset_cset(dst.getId(), H5T_CSET_ASCII);

Check warning on line 85 in include/highfive/bits/H5ReadWrite_misc.hpp

View check run for this annotation

Codecov / codecov/patch

include/highfive/bits/H5ReadWrite_misc.hpp#L85

Added line #L85 was not covered by tests
}
}
}

Expand Down

0 comments on commit 877a76e

Please sign in to comment.