fcl-js: less hints

This commit is contained in:
mattias 2023-08-02 08:47:52 +02:00
parent 6f8e71cb87
commit b84d32fe04

View File

@ -283,6 +283,14 @@ begin
// conversion magic
SetCodePage(RawByteString(Result), CP_ACP, False);
end;
{$ifndef FPC_DOTTEDUNITS}
function LeftStr(const s: UnicodeString; Count: SizeInt): UnicodeString; overload;
begin
Result:=copy(s,1,Count);
end;
{$endif}
{$endif}
function QuoteJSString(const S: TJSString; Quote: TJSChar): TJSString;
@ -813,7 +821,7 @@ begin
val(copy(S,i+1,length(S)),Exp,Code);
if Code=0 then
begin
S2:='1E'+IntToStr(Exp+1);
S2:='1E'+TJSString(IntToStr(Exp+1));
if S[1]='-' then
S2:='-'+S2;
end;
@ -853,7 +861,7 @@ begin
Delete(S,length(S),1);
if S[length(S)]='.' then
Delete(S,length(S),1);
S2:=S+'E'+IntToStr(Exp);
S2:=S+'E'+TJSString(IntToStr(Exp));
j:=Pos('.',S);
if j>0 then
begin
@ -900,7 +908,7 @@ begin
else
begin
// e.g. 1.1E+0010 -> 1.1E10
S:=LeftStr(S,i)+IntToStr(Exp);
S:=LeftStr(S,i)+TJSString(IntToStr(Exp));
if (i >= 4) and (s[i-1] = '0') and (s[i-2] = '.') then
// e.g. 1.0E22 -> 1E22
Delete(S, i-2, 2);
@ -976,7 +984,7 @@ begin
end
else
begin
OldParams:=FD.Params;
OldParams:=FD.{%H-}Params;
For I:=0 to OldParams.Count-1 do
begin
write(OldParams[i]);