-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow reading not-quite null-terminated strings. #1056
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1056 +/- ##
==========================================
+ Coverage 87.06% 87.09% +0.03%
==========================================
Files 101 101
Lines 6091 6108 +17
==========================================
+ Hits 5303 5320 +17
Misses 788 788 ☔ View full report in Codecov by Sentry. |
1uc
force-pushed
the
1uc/not-so-null-terminated
branch
from
November 3, 2024 11:23
07f5db1
to
f3885ca
Compare
matz-e
approved these changes
Nov 4, 2024
1uc
added a commit
that referenced
this pull request
Nov 28, 2024
For fixed-length strings that have a padding mode that suggests they're null-terminated are in fact not required to be null-terminated, we (silently) fail to read the last character. Since, HDF5 will create such string, h5dump will display the file and h5py will read the string; we opted to allow it and also read the string into and `std::string` (which is variable length and already not guaranteed to have the same length as the fixed length string). HighFive will continue to not allow writing null-terminated strings that aren't via `write`. Backports: (#1056)
1uc
added a commit
that referenced
this pull request
Nov 28, 2024
For fixed-length strings that have a padding mode that suggests they're null-terminated are in fact not required to be null-terminated, we (silently) fail to read the last character. Since, HDF5 will create such string, h5dump will display the file and h5py will read the string; we opted to allow it and also read the string into and `std::string` (which is variable length and already not guaranteed to have the same length as the fixed length string). HighFive will continue to not allow writing null-terminated strings that aren't via `write`. Backports: (#1056)
1uc
added a commit
that referenced
this pull request
Dec 2, 2024
* backport: Allow reading not-quite null-terminated strings. For fixed-length strings that have a padding mode that suggests they're null-terminated are in fact not required to be null-terminated, we (silently) fail to read the last character. Since, HDF5 will create such string, h5dump will display the file and h5py will read the string; we opted to allow it and also read the string into and `std::string` (which is variable length and already not guaranteed to have the same length as the fixed length string). HighFive will continue to not allow writing null-terminated strings that aren't via `write`. * backport: Fix off-by-one in char_buffer_length. Backports: (#1056), ( #1060)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #1054. Essentially, it seems that fixed-length strings that have a padding mode that suggests they're null-terminated are in fact not required to be null-terminated. HDF5 will create such string,
h5dump
will display the file andh5py
will read the string.HighFive will continue to not allow writing null-terminated strings that aren't. This PR proposes that it should allow reading such strings into
std::string
.