From dae14bed088f441873340f0d90f48bdeba10db29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Mon, 14 May 2018 16:12:21 +0200 Subject: [PATCH] Fixed issue #110 : Correct NativeInt and NativeUInt declaration in FPC --- packages/cef4delphi_lazarus.lpk | 8 ++++++++ source/cef.inc | 2 +- source/uCEFApplication.pas | 4 ++-- source/uCEFMiscFunctions.pas | 2 +- source/uCEFTypes.pas | 31 ++++++++++++++++++------------- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index dc675864..ac2bb828 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -4,6 +4,7 @@ + @@ -12,7 +13,14 @@ + + + + + + + diff --git a/source/cef.inc b/source/cef.inc index cda5fc23..8ad3597b 100644 --- a/source/cef.inc +++ b/source/cef.inc @@ -144,7 +144,7 @@ {$DEFINE DELPHI15_UP} {$ENDIF} -// Delphi XE2 +// Delphi XE2 (First 64bit compiler) {$IFDEF VER230} {$UNDEF DELPHI_VERSION_UNKNOW} {$DEFINE DELPHI5_UP} diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas index 29302a3d..179ea6dd 100644 --- a/source/uCEFApplication.pas +++ b/source/uCEFApplication.pas @@ -500,8 +500,8 @@ begin UpdateDeviceScaleFactor; + FillChar(FAppSettings, SizeOf(TCefSettings), 0); FAppSettings.size := SizeOf(TCefSettings); - FillChar(FAppSettings, FAppSettings.size, 0); FChromeVersionInfo.MajorVer := CEF_CHROMEELF_VERSION_MAJOR; FChromeVersionInfo.MinorVer := CEF_CHROMEELF_VERSION_MINOR; @@ -952,7 +952,7 @@ begin InitializeSettings(FAppSettings); - TempArgs.instance := HINSTANCE; + TempArgs.instance := HINSTANCE{$IFDEF FPC}(){$ENDIF}; if (cef_initialize(@TempArgs, @FAppSettings, aApp.Wrap, FWindowsSandboxInfo) <> 0) then begin diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas index 0197f7db..494093aa 100644 --- a/source/uCEFMiscFunctions.pas +++ b/source/uCEFMiscFunctions.pas @@ -1007,7 +1007,7 @@ end; function GetModulePath : string; begin - Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HInstance))); + Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE{$IFDEF FPC}(){$ENDIF}))); end; function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean; diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas index 7fa35c6b..1a81b6e5 100644 --- a/source/uCEFTypes.pas +++ b/source/uCEFTypes.pas @@ -234,23 +234,28 @@ type TCefSSLContentStatus = Cardinal; // /include/internal/cef_types.h (cef_ssl_content_status_t) TCefLogSeverity = Cardinal; // /include/internal/cef_types.h (cef_log_severity_t) -{$IFNDEF DELPHI12_UP} - NativeUInt = Cardinal; +{$IFDEF FPC} + NativeInt = PtrInt; + NativeUInt = PtrUInt; + PNativeInt = ^NativeInt; PNativeUInt = ^NativeUInt; - NativeInt = Integer; - uint16 = Word; - {$IFDEF FPC} ustring = type UnicodeString; - {$ELSE} - ustring = type WideString; - {$ENDIF} rbstring = type AnsiString; {$ELSE} - ustring = type string; - rbstring = type RawByteString; - {$IFNDEF DELPHI15_UP} - NativeUInt = Cardinal; - PNativeUInt = ^NativeUInt; + {$IFNDEF DELPHI12_UP} + NativeUInt = Cardinal; + PNativeUInt = ^NativeUInt; + NativeInt = Integer; + uint16 = Word; + ustring = type WideString; + rbstring = type AnsiString; + {$ELSE} + ustring = type string; + rbstring = type RawByteString; + {$IFNDEF DELPHI15_UP} + NativeUInt = Cardinal; + PNativeUInt = ^NativeUInt; + {$ENDIF} {$ENDIF} {$ENDIF}