John Luke wrote: [...] >> I must admit that I don't exactly know how the content of a string >> is passed to the non-managed context. Because of the fact that a >> string is composed of chars (which represent 2-byte unicode characters), >> the raw string buffer presumably is a char array. IMO a byte array >> would be much better suited (it simply is more generic). >> > Yes. If you can resend it as a patch, something like that could probably > be committed.
Ok, here it is. phb
diff -Naur mono-1.1.14-orig/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs mono-1.1.14/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs --- mono-1.1.14-orig/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs 2006-03-14 00:01:10.000000000 +0100 +++ mono-1.1.14/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs 2006-04-15 10:23:43.000000000 +0200 @@ -246,7 +246,7 @@ internal static extern IntPtr cairo_image_surface_create (Cairo.Format format, int width, int height); [DllImport (cairo)] - internal static extern IntPtr cairo_image_surface_create_for_data (string data, Cairo.Format format, int width, int height, int stride); + internal static extern IntPtr cairo_image_surface_create_for_data (byte[] data, Cairo.Format format, int width, int height, int stride); [DllImport (cairo)] internal static extern IntPtr cairo_image_surface_create_from_png (string filename); diff -Naur mono-1.1.14-orig/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs mono-1.1.14/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs --- mono-1.1.14-orig/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs 2006-03-14 00:01:10.000000000 +0100 +++ mono-1.1.14/mcs/class/Mono.Cairo/Mono.Cairo/Surface.cs 2006-04-15 10:23:59.000000000 +0200 @@ -47,7 +47,7 @@ } } - public ImageSurface (string data, Cairo.Format format, int width, int height, int stride) + public ImageSurface (ref byte[] data, Cairo.Format format, int width, int height, int stride) { surface = CairoAPI.cairo_image_surface_create_for_data (data, format, width, height, stride); lock (surfaces.SyncRoot){ @@ -183,7 +183,7 @@ [Obsolete ("Use an ImageSurface constructor instead.")] public static Cairo.Surface CreateForImage ( - string data, Cairo.Format format, int width, int height, int stride) + ref byte[] data, Cairo.Format format, int width, int height, int stride) { IntPtr p = CairoAPI.cairo_image_surface_create_for_data ( data, format, width, height, stride);
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list