Skip to content

Commit

Permalink
Fix bug in enforce_ascii_hack. (#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored Nov 24, 2023
1 parent 9314815 commit 90f8fd6
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);
}
}
}

Expand Down

0 comments on commit 90f8fd6

Please sign in to comment.