From 7aaa84847438d90dc8c104b4d49051e928cf2e5d Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Mon, 15 Nov 2021 13:39:19 +0100 Subject: [PATCH 1/2] use file datatype to read strings --- src/h5cpp/node/dataset.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/h5cpp/node/dataset.hpp b/src/h5cpp/node/dataset.hpp index 7270d4bf73..0377c9273f 100644 --- a/src/h5cpp/node/dataset.hpp +++ b/src/h5cpp/node/dataset.hpp @@ -1178,9 +1178,15 @@ void Dataset::write_reshape(const T &data, template void Dataset::read(T &data,const property::DatasetTransferList &dtpl) { - hdf5::datatype::DatatypeHolder mem_type_holder; hdf5::dataspace::DataspaceHolder mem_space_holder(space_pool); - read_reshape(data, mem_type_holder.get(data), mem_space_holder.get(data), dtpl); + if(file_type_class == datatype::Class::String){ + // in hdf5 1.12.1 UFT8 data cannot be read to the ASCII buffer + read_reshape(data, file_type, mem_space_holder.get(data), dtpl); + } + else { + hdf5::datatype::DatatypeHolder mem_type_holder; + read_reshape(data, mem_type_holder.get(data), mem_space_holder.get(data), dtpl); + } } template From 2a3f7b30ab0ae638e13e07ef8cb131d200973c8b Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Mon, 15 Nov 2021 13:45:37 +0100 Subject: [PATCH 2/2] fix typo --- src/h5cpp/node/dataset.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/h5cpp/node/dataset.hpp b/src/h5cpp/node/dataset.hpp index 0377c9273f..81cb3d15ce 100644 --- a/src/h5cpp/node/dataset.hpp +++ b/src/h5cpp/node/dataset.hpp @@ -1180,7 +1180,7 @@ void Dataset::read(T &data,const property::DatasetTransferList &dtpl) { hdf5::dataspace::DataspaceHolder mem_space_holder(space_pool); if(file_type_class == datatype::Class::String){ - // in hdf5 1.12.1 UFT8 data cannot be read to the ASCII buffer + // in hdf5 1.12.1 UFT8 data cannot be read to an ASCII buffer read_reshape(data, file_type, mem_space_holder.get(data), dtpl); } else {