HDFGroup / HDFGroup/hdf5

H5DataSet read and write H5std_string functions are likely to get called accidentally

Open
#2,501 18 comments 0 reactions 1 assignee Assigned to @mattjala View on GitHub
Component - Wrappers
Dominant language
C
Stars
988
Forks
355
Avg merge
4d 2h
Merged PRs (30d)
12

Description

The `H5DataSet` `read` and `write` functions have options for doing so with either a `void*` or a `H5std_string`.

We ran into an issue with a Java binding for HDF5, documented [here](https://github.com/bytedeco/javacpp-presets/issues/1311).

The issue was that in trying to read and write bytes to an `H5DataSet`, we were accidentally calling the `H5std_string` versions without knowing it and the `read` function in that case will terminate the read on any `0` bytes.

It took a while to figure out why we couldn't read and write bytes when other types (ints, floats, etc) worked fine. Our team spent several days scratching our heads.

I was wondering if the same issue might apply to all users of HDF5, who might be wishing to read `char*` with `0`s in it and getting unexpected results.

Once possible solution would be to rename the `H5std_string` versions to `readString` and `writeString`. What do you guys think?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.