Browse Source

* Fix compilation of unicode RTL after patch by Rika

Michaël Van Canneyt 1 year ago
parent
commit
5034440383
1 changed files with 6 additions and 4 deletions
  1. 6 4
      packages/rtl-objpas/src/inc/strutils.pp

+ 6 - 4
packages/rtl-objpas/src/inc/strutils.pp

@@ -185,7 +185,7 @@ resourcestring
 
 function IsEmptyStr(const S: string; const EmptyChars: TSysCharSet): Boolean;
 function DelSpace(const S: string): string;
-function DelChars(const S: string; Chr: AnsiChar): string;
+function DelChars(const S: string; Chr: Char): string;
 function DelChars(const S: string; Chars: TSysCharSet): string;
 function DelSpace1(const S: string): string;
 function Tab2Space(const S: string; Numb: Byte): string;
@@ -1954,7 +1954,8 @@ function DelChars(const S: string; Chars: TSysCharSet): string;
 
 var
   Ss, Sp, Se, Rp: PChar;
-
+  aDelta : Integer;
+  
 begin
   Ss := PChar(Pointer(S));
   Sp := Ss;
@@ -1966,8 +1967,9 @@ begin
   SetLength(result, SizeUint(Pointer(Se) - Pointer(Ss)) div sizeof(Char));
   Rp := PChar(Pointer(Result));
   repeat
-    Move(Ss^, Rp^, Pointer(Sp) - Pointer(Ss));
-    Inc(Pointer(Rp), Pointer(Sp) - Pointer(Ss));
+    aDelta:=(Pointer(Sp) - Pointer(Ss))*SizeOf(Char);
+    Move(Ss^, Rp^, aDelta);
+    Inc(Pointer(Rp), aDelta);
     repeat
       Inc(Sp); // Can increment to Se + 1.
     until (Sp >= Se) or not (Sp^ in Chars);