#1501: Include string null terminator in HDF5 attributes ----------------------------+----------------------------------------------- Reporter: barry.wardell | Owner: eschnett Type: enhancement | Status: new Priority: major | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: ----------------------------+-----------------------------------------------
Comment (by rhaas):
This requires more changes. Currently our code is written to re-add the NUL byte when the attribute is read in again (line 1248 of CarpetIOHDF5/src/Input.cc since char vector a guaranteed to be initialized to zero). Similarly in the slicers etc. So in order to not duplicate the NUL byte (almost certainly harmless and might well be stripped accidentally by an strlen) we might need to adjust the reader logic to strip duplicate NUL bytes at the end.
So currently I think our code actually is bug free, but does not adhere to the published HDF5 manual. I think it would be good to include the NUL byte since it will make using standard HDF5 tools easier.
So: the code looks fine, please also check the reader in Input.cc and the various HDF5 tools in CarpetIOHDF5/src/utils and ExternalLibraries/HDF5/src as well as (ideally) the Carpet VisIt plugin. :-)