[NeXus-code-tickets] [NeXusCode] #173: getinfo does not return available space

NeXus Data Format Library and Applications noreply at nexusformat.org
Fri Mar 6 02:32:11 GMT 2009


#173: getinfo does not return available space
-----------------------------+----------------------------------------------
 Reporter:  Pete Jemian      |       Owner:  Unassigned
     Type:  defect           |      Status:  new       
 Priority:  critical         |   Milestone:            
Component:  python bindings  |     Version:  trunk     
 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.
 ----
 (copied from [http://trac.nexusformat.org/definitions/ticket/59])

-- 
Ticket URL: <http://trac.nexusformat.org/code/ticket/173>
NeXus Data Format Library and Applications <http://www.nexusformat.org/>
NeXus Data Format Library and Applications



More information about the NeXus-code-tickets mailing list