Closed mydoghasworms closed 10 years ago
Error happens in DataContainer method [] when getting value for type :RFCTYPE_BCD.
A workaround at the moment is to change lib/datacontainer.rb to make the buffer somewhat bigger in the case of a BCD type by an arbitrary number of bytes so that it is big enough. At the moment I don't know what the correct way is to determine the buffer size for BCD, whether it's only this type or if I even cover this in the tests. But the following works for me:
when :RFCTYPE_BCD
size = metadata[:nucLength] + (metadata[:decimals] || 0)
#buf = FFI::MemoryPointer.new(:uchar, size*2)
buf = FFI::MemoryPointer.new(:uchar, size*2 + 10) #<-- increase buffer size
rc = NWRFCLib.get_chars(@handle, metadata[:name].cU, buf, size, @error.to_ptr)
Can be replicated with calling function SXMB_GET_MESSAGE_LIST and getting value of EX_FIRST_TS.