Ticket #173 (closed defect: fixed)
getinfo does not return available space
| Reported by: | Pete Jemian | Owned by: | Unassigned |
|---|---|---|---|
| Priority: | critical | Milestone: | |
| Component: | python bindings | Version: | trunk |
| Keywords: | Cc: | Paul Kienzle |
Description
For the following:
NXmakedata(10 element NX_CHAR) NXopendata() NXgetinfo()
NXgetinfo returned 0 for the array size when the data type was NX_CHAR, but size 10 for any other data type.
The python binding needs the length in order to prepare the data for writing.
The problem is related to the default stripping of spaces from strings by the NeXus API – passing NOSTRIP to NXopen() results in NXgetinfo returning 10 for the string size.
This raises the general question: how can you determine the maximum size you can write to a NX_CHAR array? The NeXus file may not have been opened NOSTRIP by a user of the python API, so to use the NOSTRIP workaround would mean python opening the file with NOSTRIP and then emulating the stripping behaviour. The documentation for NXgetinfo() does not say whether, for a string, it should return the current or declared size - is a new API function the only way? If NXgetinfo() has only been used to determine how much memory to allocate for a string then changing it would not break anything; however if code relies on it effectively doing a strlen() then this may break.
(copied from http://trac.nexusformat.org/definitions/ticket/59)

(In [1220]) - Added a NXgetrawinfo function in the internal section. This function does