Skip to content
Permalink
Browse files

leverage cardinal/longword cross-compiler and cross-platform use

  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed May 8, 2019
1 parent d1ebeda commit b206bbd50c97fefd1141816df34b0481ea2a6aef
Showing with 25 additions and 22 deletions.
  1. +5 −2 SQLite3/mORMot.pas
  2. +3 −3 SQLite3/mORMotReport.pas
  3. +12 −12 SynFPCSock.pas
  4. +2 −2 SynOpenSSL.pas
  5. +1 −1 SynSMAPI.pas
  6. +1 −1 SynVirtualDataSet.pas
  7. +1 −1 SynopseCommit.inc
@@ -54886,6 +54886,7 @@ function TServiceContainer.CallBackUnRegister(const Callback: IInvokable): boole
CONST_PSEUDO_RESULT_NAME: string[6] = 'Result';
CONST_PSEUDO_SELF_NAME: string[4] = 'Self';
CONST_INTEGER_NAME: string[7] = 'Integer';
CONST_CARDINAL_NAME: string[8] = 'Cardinal';

type
/// map the stack memory layout at TInterfacedObjectFake.FakeCall()
@@ -56656,10 +56657,12 @@ procedure TInterfaceFactoryGenerated.AddMethod(
raise EInterfaceFactoryException.CreateUTF8('%: expect TypeInfo() at #% for %.AddMethod("%")',
[fInterfaceTypeInfo^.Name,a,self,aName]);
arg^.ArgTypeInfo := aParams[a*ARGPERARG+2].VPointer;
{$ifdef FPC} // under FPC, TypeInfo(Integer)=TypeInfo(Longint)
{$ifdef FPC} // under FPC, TypeInfo(Integer/Cardinal)=TypeInfo(LongInt/LongWord)
if arg^.ArgTypeInfo=TypeInfo(Integer) then
arg^.ArgTypeName := @CONST_INTEGER_NAME else
{$endif}
if arg^.ArgTypeInfo=TypeInfo(Cardinal) then
arg^.ArgTypeName := @CONST_CARDINAL_NAME else
{$endif FPC}
arg^.ArgTypeName := @arg^.ArgTypeInfo^.Name;
end;
end;
@@ -4186,9 +4186,9 @@ procedure TGDIPages.DrawTextAcrossColsFromCSV(var CSV: PWideChar; BackgroundColo
/// round inverted color to white or black
function clAlways(cl: TColor): TColor;
begin
if ((GetRValue(longword(cl)) * 2) +
(GetGValue(longword(cl)) * 3) +
(GetBValue(longword(cl)) * 2)) < 600 then
if ((GetRValue(cardinal(cl)) * 2) +
(GetGValue(cardinal(cl)) * 3) +
(GetBValue(cardinal(cl)) * 2)) < 600 then
result := clWhite else
result := clBlack;
end;
@@ -66,7 +66,7 @@
{$define LINUX} // a Linux-based system
{$endif}

// BSD definition of scoketaddr
// BSD definition of socketaddr
{$ifdef FREEBSD}
{$DEFINE SOCK_HAS_SINLEN}
{$endif}
@@ -413,7 +413,7 @@ function ResolveIPToName(const IP: string; Family,SockProtocol,SockType: integer
function ResolvePort(const Port: string; Family,SockProtocol,SockType: integer): Word;

function fpbind(s:cint; addrx: psockaddr; addrlen: tsocklen): cint; inline;
function fplisten(s:cint; backlog : cint): cint; inline;
function fplisten(s:cint; backlog: cint): cint; inline;
function fprecv(s:cint; buf: pointer; len: size_t; Flags: cint): ssize_t; inline;
function fpsend(s:cint; msg:pointer; len:size_t; flags:cint): ssize_t; inline;

@@ -437,11 +437,11 @@ function fpsend(s:cint; msg:pointer; len:size_t; flags:cint): ssize_t; inline;
AF_INET: (sin_port: word;
sin_addr: TInAddr;
sin_zero: array[0..7] of Char);
AF_INET6:(sin6_port: word;
sin6_flowinfo: longword;
AF_INET6:(sin6_port: word; // see sockaddr_in6
sin6_flowinfo: cardinal;
sin6_addr: TInAddr6;
sin6_scope_id: longword);
AF_UNIX: (sun_path: array[0..{$ifdef SOCK_HAS_SINLEN}104{$else}107{$endif}] of Char);
sin6_scope_id: cardinal);
AF_UNIX: (sun_path: array[0..{$ifdef SOCK_HAS_SINLEN}103{$else}107{$endif}] of Char);
);
end;

@@ -459,11 +459,11 @@ function GetSockOpt(s: TSocket; level,optname: Integer; optval: pointer;
function SendTo(s: TSocket; Buf: pointer; len,flags: Integer; addrto: TVarSin): Integer;
function RecvFrom(s: TSocket; Buf: pointer; len,flags: Integer; var from: TVarSin): Integer;
function ntohs(netshort: word): word;
function ntohl(netlong: longword): longword;
function ntohl(netlong: cardinal): cardinal;
function Listen(s: TSocket; backlog: Integer): Integer;
function IoctlSocket(s: TSocket; cmd: DWORD; var arg: integer): Integer;
function htons(hostshort: word): word;
function htonl(hostlong: longword): longword;
function htonl(hostlong: cardinal): cardinal;
function GetSockName(s: TSocket; var name: TVarSin): Integer;
function GetPeerName(s: TSocket; var name: TVarSin): Integer;
function Connect(s: TSocket; const name: TVarSin): Integer;
@@ -839,7 +839,7 @@ function ntohs(netshort: word): word;
result := {$ifdef KYLIX3}LibC{$else}sockets{$endif}.ntohs(NetShort);
end;

function ntohl(netlong: longword): longword;
function ntohl(netlong: cardinal): cardinal;
begin
result := {$ifdef KYLIX3}LibC{$else}sockets{$endif}.ntohl(NetLong);
end;
@@ -862,12 +862,12 @@ function IoctlSocket(s: TSocket; cmd: DWORD; var arg: integer): Integer;

function htons(hostshort: word): word;
begin
result := {$ifdef KYLIX3}LibC{$else}sockets{$endif}.htons(Hostshort);
result := {$ifdef KYLIX3}LibC{$else}sockets{$endif}.htons(hostshort);
end;

function htonl(hostlong: longword): longword;
function htonl(hostlong: cardinal): cardinal;
begin
result := {$ifdef KYLIX3}LibC{$else}sockets{$endif}.htonl(HostLong);
result := {$ifdef KYLIX3}LibC{$else}sockets{$endif}.htonl(hostlong);
end;

function CloseSocket(s: TSocket): Integer;
@@ -146,7 +146,7 @@ TASN1_STRING = record
length: integer;
type_: integer;
data: PAnsiChar;
flags: Longword;
flags: longint;
end;
PASN1_STRING = ^TASN1_STRING;

@@ -174,7 +174,7 @@ TCRYPTO_dynlock_value = record

TStatLockLockCallback = procedure(Mode: integer; N: integer; _file: PAnsiChar;
Line: integer); cdecl;
TStatLockIDCallback = function: Longword; cdecl;
TStatLockIDCallback = function: longint; cdecl;
TCryptoThreadIDCallback = procedure(ID: PCRYPTO_THREADID); cdecl;
TDynLockCreateCallback = function(_file: PAnsiChar; Line: integer):
PCRYPTO_dynlock_value; cdecl;
@@ -135,7 +135,7 @@ interface
/// 16 bit unsigned integer type for SMAPI
JSUint16 = Word;
/// 32 bit unsigned integer type for SMAPI
JSUInt32 = LongWord;
JSUInt32 = Cardinal;
/// 64 bit signed integer type for SMAPI
JSInt64 = Int64;
/// 64 bit unsigned integer type for SMAPI
@@ -729,7 +729,7 @@ TFMTBcdData = class(TPersistent)
VType: TVarType;
Reserved1, Reserved2, Reserved3: Word;
VBcd: TFMTBcdData;
Reserved4: LongWord;
Reserved4: Cardinal;
end;

class procedure TSynVirtualDataSet.BcdWrite(const aWriter: TTextWriter; const aValue);
@@ -1 +1 @@
'1.18.5211'
'1.18.5212'

0 comments on commit b206bbd

Please sign in to comment.
You can’t perform that action at this time.