Errors in UnmanagedMarshal
Marcus <[email protected]>
| Newsgroups | gmane.comp.gnu.dotgnu.developer |
|---|---|
| Message-ID | <[email protected]> |
I think that there are a couple of errors UnmanagedMarshal.ToBytes():
if(elemCount < 0x80)
{
bytes = new byte [1]; <-- shouldn't this be "new byte [2]"?
bytes[0] = (byte)type;
bytes[1] = (byte)elemCount;
}
else if(elemCount < 0x4000)
{
bytes = new byte [2]; <-- shouldn't this be new bytes [3]"?
bytes[0] = (byte)type;
bytes[1] = (byte)((elemCount >> 8) | 0x80);
bytes[2] = (byte)(elemCount & 0xFF);
}