Browse Source

fcl-js: less hints

mattias 2 years ago
parent
commit
b84d32fe04
1 changed files with 12 additions and 4 deletions
  1. 12 4
      packages/fcl-js/src/jswriter.pp

+ 12 - 4
packages/fcl-js/src/jswriter.pp

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