fix(tools): h5rs dump shows NUL padding in nested strings, like h5dump
A null-padded fixed string inside a compound or an array member printed
trimmed ("" for three NULs, "a" for "a\0b"), where h5dump prints every
byte ("\000\000\000", "a\000b"); only top-level strings were shown in
full. DATA blocks now render elements through one function that keeps
the padding at any depth.
The README now lists the remaining known differences from h5dump:
nested compounds print inline, and long double values are printed as
errors (exit 1) with the datatype as an H5T_FLOAT block.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -72,10 +72,22 @@ groups; integers of both byte orders, floats, compound with an array member,
|
||||
enum, fixed and variable-length strings; soft, external and hard links; a
|
||||
named datatype; compact and dense attributes) `h5rs dump` and `h5rs dump -A`
|
||||
print the same bytes as h5dump 1.14.6 — `dump_matches_h5dump` in
|
||||
`tests/h5rs_interop.rs` checks this. Not covered by that test: references,
|
||||
opaque, bitfield, variable-length sequences and virtual datasets. Floats print at their own precision (a `float32` 0.1 prints as
|
||||
`0.1`), which for some values is more digits than h5dump's `%g`. The `-p`
|
||||
block is h5rs's own (it names the chunk index), not h5dump's.
|
||||
`tests/h5rs_interop.rs` checks this, and `dump_shows_nul_padding_in_nested_strings`
|
||||
that null-padded strings show their NULs (`"a\000b"`) at any depth, as
|
||||
h5dump's do. Not covered by those tests: references, opaque, bitfield,
|
||||
variable-length sequences and virtual datasets. Known differences from
|
||||
h5dump:
|
||||
|
||||
- Floats print at their own precision (a `float32` 0.1 prints as `0.1`),
|
||||
which for some values is more digits than h5dump's `%g`.
|
||||
- A compound nested in a compound prints inline (`{ 1, 2.5 }`) where
|
||||
h5dump prints it as an indented block, one member per line; only the
|
||||
outer compound is a block.
|
||||
- `long double` (x87 80-bit) and other floats wider than 64 bits: the
|
||||
datatype is printed as an `H5T_FLOAT { ... }` block instead of h5dump's
|
||||
one-line description, and each value as `<error: ...>`; `dump` then
|
||||
exits 1. The library cannot convert them (see `docs/known-issues.md`).
|
||||
- The `-p` block is h5rs's own (it names the chunk index), not h5dump's.
|
||||
|
||||
### JSON schema
|
||||
|
||||
|
||||
Reference in New Issue
Block a user