Hello,
first of all great thanks to all contibutors to this great library!
I am using the c++ open-dis library and have recognized a bug at the marhalling and unmarshalling of the VariableDatum DIS-Record.
Here are the manual fixes of the c++ code (at the for-loop the number of bits instead of bytes were used) - hopefully you may integrate it into the code-generation though XMLPG:
void VariableDatum::marshal(DataStream& dataStream) const
{
dataStream << _variableDatumID;
dataStream << ( unsigned int )_variableDatums.size();
//DK: Fixed bit/byte number error in for-loop which caused crashed for(size_t idx = 0; idx < _variableDatums.size() / 8; idx+=8) { EightByteChunk x = _variableDatums[idx]; x.marshal(dataStream); }
}
void VariableDatum::unmarshal(DataStream& dataStream)
{
dataStream >> _variableDatumID;
dataStream >> _variableDatumLength;
_variableDatums.clear(); //DK: Fixed bit/byte number error in for-loop which caused crashed for(size_t idx = 0; idx < _variableDatumLength / 8; idx+=8) { EightByteChunk x; x.unmarshal(dataStream); _variableDatums.push_back(x); }
}
Kind regards,
Daniel Kallfass
Logged In: YES
user_id=457760
Originator: NO
Has this been fixed in the source code generator so that both Java and C++ are correct? -John
Logged In: NO
Hi,
It seams that a similar problem exist in the java code. Since variableDatums is a List the variableDatums.size() will return the number of items in the list and not the number of bits in the list.
Replacing "dos.writeInt( (int)variableDatums.size());" with "dos.writeInt( (int)variableDatums.size()*64);" should do the trick.