hedgewars/uUtils.pas
changeset 10131 4b4a043111f4
parent 10127 7f29a65aa1e4
child 10280 762c256552e9
--- a/hedgewars/uUtils.pas	Tue Feb 11 22:05:03 2014 +0400
+++ b/hedgewars/uUtils.pas	Wed Feb 12 00:50:15 2014 +0400
@@ -25,10 +25,7 @@
 
 procedure SplitBySpace(var a, b: shortstring);
 procedure SplitByChar(var a, b: shortstring; c: char);
-
-{$IFNDEF PAS2C}
-procedure SplitByChar(var a, b: ansistring; c: char);
-{$ENDIF}
+procedure SplitByCharA(var a, b: ansistring; c: char);
 
 function  EnumToStr(const en : TGearType) : shortstring; overload;
 function  EnumToStr(const en : TVisualGearType) : shortstring; overload;
@@ -130,17 +127,22 @@
 end;
 
 {$IFNDEF PAS2C}
-procedure SplitByChar(var a, b: ansistring; c: char);
+procedure SetLengthA(var s: ansistring; len: Longword);
+begin
+    SetLength(s, len)
+end;
+{$ENDIF}
+
+procedure SplitByCharA(var a, b: ansistring; c: char);
 var i: LongInt;
 begin
 i:= Pos(c, a);
 if i > 0 then
     begin
     b:= copy(a, i + 1, Length(a) - i);
-    setlength(a, Pred(i));
+    SetLengthA(a, Pred(i));
     end else b:= '';
-end; { SplitByChar }
-{$ENDIF}
+end; { SplitByCharA }
 
 function EnumToStr(const en : TGearType) : shortstring; overload;
 begin
@@ -311,7 +313,7 @@
       begin
       CharArray[i - 1] := s[i];
       end;
-CharArray[Length(s)]:= #0;
+   CharArray[Length(s)]:= #0;
    Str2PChar:= @(CharArray[0]);
 end;
 
@@ -377,7 +379,7 @@
 {$ENDIF}
     exit;
 
-l:= Utf8ToUnicode(@tmpstr, PChar(s), min(length(tmpstr), length(s)))-1;
+l:= Utf8ToUnicode(PWideChar(@tmpstr), PChar(s), min(length(tmpstr), length(s)))-1;
 i:= 0;
 
 while i < l do