[Mono-bugs] [Bug 53700][Maj] Changed - Marshaling a Unicode StringBuilder does not work

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 20 Feb 2004 11:08:46 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jordi@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=53700

--- shadow/53700	2004-02-03 16:29:51.000000000 -0500
+++ shadow/53700.tmp.22049	2004-02-20 11:08:46.000000000 -0500
@@ -1,13 +1,13 @@
 Bug#: 53700
 Product: Mono/Runtime
 Version: unspecified
 OS: unknown
 OS Details: Windows XP SP1
-Status: RESOLVED   
-Resolution: FIXED
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Major
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: jordi@ximian.com               
 QAContact: mono-bugs@ximian.com
@@ -66,6 +66,44 @@
 
 
 ------- Additional Comments From jordi@ximian.com  2004-02-03 16:29 -------
 Zoltan,
 
 It works perfectly. Thanks. Jordi,
+
+------- Additional Comments From jordi@ximian.com  2004-02-20 11:08 -------
+The problem now is that code works well on win32 but fails on Linux
+using the same example.
+
+On Linux no string is copied at all for some reason. It works if the
+string is encoded in ANSI and the charset is changed to Ansi, but if
+the charset is Unicode for some reason does not work.
+
+Here you have the Linux function that implements GdipGetFamilyName.
+
+GpStatus
+GdipGetFamilyName(GDIPCONST GpFontFamily* family, WCHAR
+name[LF_FACESIZE], int language)
+{                
+    if (!family) return InvalidParameter;
+
+    FcChar8* str;
+    glong items_read = 0;
+    glong items_written = 0;
+
+    FcResult r = FcPatternGetString (family, FC_FAMILY, 0, &str);
+
+    gunichar2* pStr =  g_utf8_to_utf16 ((const gchar *)str, -1,
+&items_read, &items_written,NULL);
+
+    printf("GdipGetFamilyName %s, %u\n", str,items_written);
+
+    if (items_written>=(LF_FACESIZE-1))
+      items_written=(LF_FACESIZE-1);
+
+    memcpy (name, str, items_written*sizeof(WCHAR));
+    name[1+items_written*sizeof(WCHAR)]='\0x0';
+    
+    g_free(pStr);
+
+    return Ok;
+}