Browse Source

rtl: clean up

mattias 5 years ago
parent
commit
1bf007ef13
2 changed files with 10 additions and 6 deletions
  1. 2 2
      packages/rtl/system.pas
  2. 8 4
      packages/rtl/sysutils.pas

+ 2 - 2
packages/rtl/system.pas

@@ -365,7 +365,7 @@ function Pos(const Search, InString: String; StartAt : Integer): Integer; assemb
 procedure Insert(const Insertion: String; var Target: String; Index: Integer); overload;
 function upcase(c : char) : char; assembler;
 function HexStr(Val: NativeInt; cnt: byte): string; external name 'rtl.hexStr'; overload;
-function binstr(val : int64; cnt : byte) : string;
+function binstr(val : NativeUInt; cnt : byte) : string;
 
 procedure val(const S: String; out NI : NativeInt; out Code: Integer); overload;
 procedure val(const S: String; out NI : NativeUInt; out Code: Integer); overload;
@@ -716,7 +716,7 @@ begin
     Code:=1;
 end;
 
-function binstr(val : int64;cnt : byte) : string;
+function binstr(val : NativeUInt;cnt : byte) : string;
 var
   i : Integer;
 begin

+ 8 - 4
packages/rtl/sysutils.pas

@@ -2309,7 +2309,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
       If Fmt[ChPos]='*' then
         begin
 
-        if Index=-1 then
+        if Index=High(byte) then
           ArgN:=Argpos
         else
         begin
@@ -2395,7 +2395,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
 
 
   begin
-    Index:=-1;
+    Index:=High(byte);
     Width:=-1;
     Prec:=-1;
     Value:=-1;
@@ -4499,8 +4499,11 @@ function IntToHex(Value: NativeInt; Digits: integer): string;
 begin
 //  Result:=HexStr(Value,Digits);     // TestNegLongintHelper  Failed: "ToHexString" expected: <FFFE0000> but was: <00-20000> !
   Result:='';
+  if Value<0 then
+    asm
+    if (Value<0) Value = 0xFFFFFFFF + Value + 1;
+    end;
   asm
-  if (Value<0) Value = 0xFFFFFFFF + Value + 1;
   Result=Value.toString(16);
   end;
   Result:=UpperCase(Result);
@@ -6274,7 +6277,8 @@ Var
       Result:=S.IndexOfAnyUnQuoted(Separators,AQuoteStart,AQuoteEnd,StartIndex,Match)
     else
       // MVC todo:
-      Result:=-1; // S.IndexOfAny(Separators,StartIndex,Length,Match);
+      //Result:=-1;
+      Result:=S.IndexOfAny(Separators,StartIndex,Length,Match);
   end;
 
   Procedure MaybeGrow(Curlen : SizeInt);