Browse Source

pastojs: less hints

mattias 3 years ago
parent
commit
859755ac85

+ 5 - 5
packages/pastojs/src/pas2jsfileutilswin.inc

@@ -114,7 +114,7 @@ begin
 
 
   //writeln('StrLen(PCmdLineW) = ',CmdLen);
   //writeln('StrLen(PCmdLineW) = ',CmdLen);
 
 
-  SetLength(CmdLineW, CmdLen);
+  SetLength(CmdLineW{%H-}, CmdLen);
   Move(PCmdLineW^, CmdLineW[1], CmdLen * SizeOf(WChar));
   Move(PCmdLineW^, CmdLineW[1], CmdLen * SizeOf(WChar));
 
 
 
 
@@ -246,7 +246,7 @@ begin
   if not (DriveNr = 0) then
   if not (DriveNr = 0) then
   begin
   begin
     res := GetCurrentDirectoryW(0, nil);
     res := GetCurrentDirectoryW(0, nil);
-    SetLength(SavedDir, res);
+    SetLength(SavedDir{%H-}, res);
     res:=Windows.GetCurrentDirectoryW(res, @SavedDir[1]);
     res:=Windows.GetCurrentDirectoryW(res, @SavedDir[1]);
     SetLength(SavedDir,res);
     SetLength(SavedDir,res);
 
 
@@ -259,7 +259,7 @@ begin
     end;
     end;
   end;
   end;
   res := GetCurrentDirectoryW(0, nil);
   res := GetCurrentDirectoryW(0, nil);
-  SetLength(w, res);
+  SetLength(w{%H-}, res);
   res := GetCurrentDirectoryW(res, @w[1]);
   res := GetCurrentDirectoryW(res, @w[1]);
   SetLength(w, res);
   SetLength(w, res);
   Dir:=UTF16ToUTF8(w);
   Dir:=UTF16ToUTF8(w);
@@ -391,7 +391,7 @@ begin
   // Exception.Create('[GetCurrentDirWide] The concept of the current directory doesn''t exist in Windows CE');
   // Exception.Create('[GetCurrentDirWide] The concept of the current directory doesn''t exist in Windows CE');
   {$else}
   {$else}
   res:=GetCurrentDirectoryW(0, nil);
   res:=GetCurrentDirectoryW(0, nil);
-  SetLength(w, res);
+  SetLength(w{%H-}, res);
   res:=Windows.GetCurrentDirectoryW(res, @w[1]);
   res:=Windows.GetCurrentDirectoryW(res, @w[1]);
   SetLength(w, res);
   SetLength(w, res);
   Result:=UTF16ToUTF8(w);
   Result:=UTF16ToUTF8(w);
@@ -598,7 +598,7 @@ begin
   // this will null-terminate
   // this will null-terminate
   if UTF16WordCnt>0 then
   if UTF16WordCnt>0 then
   begin
   begin
-    setlength(UTF16Str, UTF16WordCnt);
+    setlength(UTF16Str{%H-}, UTF16WordCnt);
     MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Pointer(s), length(s), @UTF16Str[1], UTF16WordCnt);
     MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Pointer(s), length(s), @UTF16Str[1], UTF16WordCnt);
     Result:=UTF16ToUTF8(UTF16Str);
     Result:=UTF16ToUTF8(UTF16Str);
   end;
   end;

+ 1 - 1
packages/pastojs/src/pas2jslogger.pp

@@ -368,7 +368,7 @@ begin
   // var
   // var
   end else if Element is TJSVarDeclaration then
   end else if Element is TJSVarDeclaration then
   begin
   begin
-    Result:=TJSVarDeclaration(Element).Name;
+    Result:=String(TJSVarDeclaration(Element).Name);
     if TJSVarDeclaration(Element).Init<>nil then
     if TJSVarDeclaration(Element).Init<>nil then
       Result+='='+DbgString(TJSVarDeclaration(Element).Init,Indent+2);
       Result+='='+DbgString(TJSVarDeclaration(Element).Init,Indent+2);