[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] Pascal-RTL: Nicht mehr Utf8ToUnicode benutzen



! Pascal-RTL: Nicht mehr Utf8ToUnicode benutzen, sondern mbstowcs, da
              die FPC-Jungs das nicht vernuenftig hinkriegen.

Signed-off-by: Antoine Kaufmann <toni@xxxxxxxxxx>
---
 src/modules/pas/lib/tyndur/tyndur.pas |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/modules/pas/lib/tyndur/tyndur.pas b/src/modules/pas/lib/tyndur/tyndur.pas
index 5cffdad..de0a133 100644
--- a/src/modules/pas/lib/tyndur/tyndur.pas
+++ b/src/modules/pas/lib/tyndur/tyndur.pas
@@ -9,6 +9,9 @@ implementation
 
     uses crt;
 
+    function c_mbstowcs(dest: PUnicodeChar; src: PChar; len: SizeUInt):
+        SizeUInt; cdecl; external name 'mbstowcs';
+
     function ReadUnicodeChar: UnicodeChar;
     var
         keys: Array [1..5] of char;
@@ -17,7 +20,7 @@ implementation
         res: Array [1..2] of UnicodeChar;
         pres: PUnicodeChar;
 
-        ret: integer;
+        ret: SizeUInt;
         i: integer;
     begin
         pkeys := @keys[1];
@@ -25,8 +28,8 @@ implementation
         for i := 1 to 4 do begin
             keys[i] := readkey;
             keys[i+1] := #0;
-            ret := Utf8ToUnicode(pres, 2, pkeys, i);
-            if ret >= 0 then begin
+            ret := c_mbstowcs(pres, pkeys, 2);
+            if ret <> SizeUInt(-1) then begin
                 break;
             end;
         end;
-- 
1.6.0.6