[Monodevelop-patches-list] r1663 - in trunk/MonoDevelop/src/Libraries/MonoDevelop.Core: . Services
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sat May 29 18:46:00 EDT 2004
Author: vlad
Date: 2004-05-29 18:46:00 -0400 (Sat, 29 May 2004)
New Revision: 1663
Modified:
trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/ChangeLog
trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/GettextCatalog.cs
Log:
2004-05-29 Vladimir Vukicevic <vladimir at pobox.com>
* Services/GettextCatalog.cs: fix marshalling issues and gettext
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/ChangeLog 2004-05-29 09:48:54 UTC (rev 1662)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/ChangeLog 2004-05-29 22:46:00 UTC (rev 1663)
@@ -1,3 +1,7 @@
+2004-05-29 Vladimir Vukicevic <vladimir at pobox.com>
+
+ * Services/GettextCatalog.cs: fix marshalling issues and gettext
+
2004-05-26 Todd Berman <tberman at sevenl.net>
* Services/GettextCatalog.cs: oops, thats not what i wanted i guess.
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/GettextCatalog.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/GettextCatalog.cs 2004-05-29 09:48:54 UTC (rev 1662)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/GettextCatalog.cs 2004-05-29 22:46:00 UTC (rev 1663)
@@ -44,23 +44,39 @@
}
[DllImport ("libmonodevelop")]
- private static extern string intl_get_string (string str);
+ private static extern IntPtr intl_get_string (IntPtr sptr);
public static string GetString (string str)
{
- return intl_get_string (str);
+ IntPtr inptr = Marshal.StringToHGlobalAuto (str);
+ IntPtr sptr = intl_get_string (inptr);
+ Marshal.FreeHGlobal (inptr);
+ if (inptr == sptr)
+ return str;
+ else
+ return Marshal.PtrToStringAuto (sptr);
}
[DllImport ("libmonodevelop")]
- private static extern string intl_get_plural_string (string singular,
- string plural,
+ private static extern IntPtr intl_get_plural_string (IntPtr singular,
+ IntPtr plural,
int n);
public static string GetPluralString (string singular,
string plural,
int n)
{
- return intl_get_plural_string (singular, plural, n);
+ IntPtr singptr = Marshal.StringToHGlobalAuto (singular);
+ IntPtr plurptr = Marshal.StringToHGlobalAuto (plural);
+ IntPtr sptr = intl_get_plural_string (singptr, plurptr, n);
+ Marshal.FreeHGlobal (singptr);
+ Marshal.FreeHGlobal (plurptr);
+ if (sptr == singptr)
+ return singular;
+ else if (sptr == plurptr)
+ return plural;
+ else
+ return Marshal.PtrToStringAuto (sptr);
}
}
}
More information about the Monodevelop-patches-list
mailing list