[Nexus] Maybe a bug?
tieman
tieman at aps.anl.gov
Fri Nov 14 19:31:03 GMT 2008
I just upgraded some of my software to use NAPI 4.1.0. I wanted to try
and convert some of my HDF4 files to XML to see if XML is viable now. I
ran into a problem.
I read in an old HDF4 file that was generated with NAPI. When I try and
write the same file out with XML, the program crashes. The program
crashes at the line:
555> memcpy(pPtr,data,dim[0]);
becuase dim[0] is some random huge number. It appears that the previous
call to NXXgetinfo which should have returned the proper dim size for
the data fails at a subcall to analyzeDim when there is a character data
field with only 1 character in it. If the character field has more than
one character, the typeString passed to analyzeDim looks like
"NX_CHAR[x>1]" but if there is a single character, the typeString passed
looks like "NX_CHAR" which causes analyzeDim to enter a switch statement
based on the variable type--which is undefined in this case.
I could fix the problem by changing the order of lines 638-641 in
nxxml.c from
638> analyzeDim(attr,rank,dimension,iType);
639> *rank = 1;
640> *iType = NX_CHAR;
to
638> *rank = 1;
639> *iType = NX_CHAR;
640> analyzeDim(attr,rank,dimension,iType);
so that type would be appropriately defined in analyzeDim.
Not sure this is the right thing to do, but it got me past that problem
and on to another one :)
Brian
More information about the NeXus
mailing list