[Mono-list] Some bugs on Mono.DataConverter

Miguel de Icaza miguel at novell.com
Wed May 30 17:25:38 EDT 2007


Hello Luis,

    Thanks for the patches and fixes

> On line 1229/1230 and 1239/1240 on PutBytesLE and PutBytesBE:
> for (; i < count; i++)
> 	dest [i-count] = *src++;
> 
> This starts putting data on an address that does not belong to the
> pointer (a negative value), crashes mono (on Linux), and makes it
> return a wrong value on Microsoft .net 2.0.
> 
> I changed it to:
> dest = &dest [count-1];
> for (; i < count; i++)
> 	*dest-- = *src++;

I changed this to:

	dest += count;
	for (; i < count; i++)
		*(--dest) = *src++;


> It doesn't compile on Microsoft .net 2.0 because of the definition of
> the var n inside the switch statements on lines 482 and 708

This seems very odd, that sounds like a bug in the Microsoft compiler.
I have added a workaround.

> , and
> "fixed (byte* target = (&dest[destIdx]))" on line 974.
>
> The last error goes away if you use "fixed (byte* target =
> &dest[destIdx])" like it is used in the other overloaded PutBytes
> methods, and I don't see any problem with that.

Am perplexed about this one as well, what was the error that you got?

I fixed it to be like the others, but am interested in knowing if we
have to modify our compiler.

> Any problems on having the XXXFromXE (byte [] data, int index) methods
> overloaded with an index of always 0? I'm not sure if there is a good
> reason for it not being there, but if there is none, and you are OK
> with it, I can also do it and submit a patch.

The only reason I did not do this is that they kind of bloat the API,
but since it is a conditional define, I have no problem including them
if you want to send a patch.

Please also provide the text to include in the documentation for the
Wiki page.

Miguel.


More information about the Mono-list mailing list