[Mono-dev] Patch for compiling System.Web/HttpResponseStream.cs under TARGET_JVM

Miguel de Icaza miguel at ximian.com
Tue Aug 30 09:24:57 EDT 2005

Hello Eyal,

> Attached is a patch for compiling HttpResponseStream.cs under TARGET_JVM.
> Under TARGET_JVM (Grasshopper) we don't support unsafe code. I therefore made the following
> changes to minimize the use of unsafe code and maximize the code sharing:
>   * I created a managed version of Chunk for the TARGET_JVM configuration.
>   * I made ByteBucket a "safe" class
>       * I modified start & pos into indices rather then pointers. I am using the Chunk
> 	to maintain the buffer.
> 	During that I removed the field 'len' which was never well maintained. I replaced
> 	its use with a local variable everywhere.
>       * I added Copy methods to Chunk in order to copy data to and from a chunk. This limited
> 	the unsafe code usage to Chunk.

This is a really nice and elegant design, thanks for doing this work.

>       * I removed the ToString method since it was unsafe - an alternative is to mark anyway the
> 	ByteBucket class as unsafe. I'd rather it stays safe so we can more easily maintain
> 	common code for this class.

ToString was just for debugging, we do not really need them.  This is

> Please provide me with your comments, especially since I am modifying here common code to
> TARGET_JVM and Mono in order to have a minimal code differences between the two.

Feel free to commit the code.


More information about the Mono-devel-list mailing list