[NeXus-definitions-tickets] [NeXusDefinitions] #59: getinfo does not return available space
NeXus Base Classes and Instrument Definitions
noreply at nexusformat.org
Wed Mar 4 13:59:35 GMT 2009
#59: getinfo does not return available space
-------------------------+--------------------------------------------------
Reporter: Paul Kienzle | Owner:
Type: defect | Status: new
Priority: critical | Keywords:
-------------------------+--------------------------------------------------
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.
--
Ticket URL: <http://trac.nexusformat.org/definitions/ticket/59>
NeXus Base Classes and Instrument Definitions <http://www.nexusformat.org/>
NeXus Base Classes and Instrument Definitions
More information about the NeXus-definitions-tickets
mailing list