1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Fixed TCefMainArgs declaration for MacOS and Linux

Fixed TCEFArgCopy for the updated TCefMainArgs declaration.
Use TCEFArgCopy for Linux targets in all IDEs
This commit is contained in:
salvadordf
2022-03-26 20:05:29 +01:00
parent 0062f1f580
commit 1700eedac7
4 changed files with 25 additions and 20 deletions

View File

@@ -51,7 +51,7 @@ interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils;
System.Classes, System.SysUtils, System.AnsiStrings;
{$ELSE}
Classes, SysUtils;
{$ENDIF}
@@ -60,7 +60,7 @@ type
TCEFArgCopy = class
protected
FArgCCopy : longint;
FArgVCopy : PPChar;
FArgVCopy : PPAnsiChar;
procedure InitializeFields;
procedure DestroyFields;
@@ -68,10 +68,10 @@ type
public
constructor Create;
destructor Destroy; override;
procedure CopyFromArgs(aArgc : longint; aArgv : PPChar);
procedure CopyFromArgs(aArgc : longint; aArgv : PPAnsiChar);
property argc : longint read FArgCCopy;
property argv : PPChar read FArgVCopy;
property argc : longint read FArgCCopy;
property argv : PPAnsiChar read FArgVCopy;
end;
implementation
@@ -109,7 +109,7 @@ begin
while (i >= 0) do
begin
if (FArgVCopy[i] <> nil) then
StrDispose(FArgVCopy[i]);
{$IFNDEF FPC}System.AnsiStrings.{$ENDIF}StrDispose(FArgVCopy[i]);
dec(i);
end;
@@ -120,7 +120,7 @@ begin
InitializeFields;
end;
procedure TCEFArgCopy.CopyFromArgs(aArgc : longint; aArgv : PPChar);
procedure TCEFArgCopy.CopyFromArgs(aArgc : longint; aArgv : PPAnsiChar);
var
i : integer;
begin
@@ -135,8 +135,13 @@ begin
while (i < aArgc) do
begin
{$IFDEF FPC}
FArgVCopy[i] := StrAlloc(length(aArgv[i]) + 1);
StrCopy(FArgVCopy[i], aArgv[i]);
{$ELSE}
FArgVCopy[i] := AnsiStrAlloc(length(aArgv[i]) + 1);
System.AnsiStrings.StrCopy(FArgVCopy[i], aArgv[i]);
{$ENDIF}
inc(i);
end;