Browse Source

Add explicit typecasts to avoid range check errors

Pierre Muller 5 days ago
parent
commit
7468addecf

+ 3 - 2
packages/fcl-process/src/amicommon/process.inc

@@ -211,7 +211,7 @@ begin
       until not FileExists(TempName);
       //sysdebugln('TProcess start: "' + ExecName + ' ' + Params+'"  >' + TempName);
       cos := AmigaDos.DosOpen(PAnsiChar(TempName), MODE_READWRITE);
-      FExitCode := LongInt(amigados.Execute(PAnsiChar(ExecName + ' ' + Params), BPTR(0), cos));
+      FExitCode := Cardinal(amigados.Execute(PAnsiChar(ExecName + ' ' + Params), BPTR(0), cos));
       DosSeek(cos, 0, OFFSET_BEGINNING);
     end;
     //FExitCode := ExecuteProcess (ExecName, Params);
@@ -328,4 +328,5 @@ end;
 function TIODescriptor.SysPrepareCreatedHandleForProcess(aHandle: THandle): THandle;
 begin
   Result:=aHandle;
-end;   
+end;
+

+ 1 - 1
packages/fcl-process/src/dummy/process.inc

@@ -118,7 +118,7 @@ begin
     ChDir (FCurrentDirectory);
    end;
   try
-   FExitCode := ExecuteProcess (ExecName, Params);
+   FExitCode := Cardinal(ExecuteProcess (ExecName, Params));
   except
 (* Normalize the raised exception so that it is aligned to other platforms. *)
     On E: EOSError do

+ 2 - 2
packages/fcl-process/src/unix/process.inc

@@ -482,8 +482,8 @@ end;
 Function TProcess.WaitOnExit : Boolean;
 begin
   if FRunning then
-    fexitcode:=waitprocess(handle);
-  Result:=(fexitcode>=0);
+    fexitcode:=Cardinal(waitprocess(handle));
+  Result:=(longint(fexitcode)>=0);
   FRunning:=False;
 end;