Repository: thrift Updated Branches: refs/heads/master 7be41c7ad -> 23d674607
THRIFT-3487 Full support for newer Delphi versions Client: Delphi Patch: Jens Geyer Contains: - fix for FStream.Seek() now expecting an UInt64 instead of Int64 - workaround to (temporarily) exclude socket support from newer versions - THIS NEEDS TO BE ADDRESSED! Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/23d67460 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/23d67460 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/23d67460 Branch: refs/heads/master Commit: 23d6746079d7b5fdb38214387c63f987e68a6d8f Parents: 7be41c7 Author: Jens Geyer <[email protected]> Authored: Sat Dec 19 11:44:57 2015 +0100 Committer: Jens Geyer <[email protected]> Committed: Sat Dec 19 11:45:34 2015 +0100 ---------------------------------------------------------------------- lib/delphi/src/Thrift.Stream.pas | 2 +- lib/delphi/src/Thrift.Transport.pas | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/23d67460/lib/delphi/src/Thrift.Stream.pas ---------------------------------------------------------------------- diff --git a/lib/delphi/src/Thrift.Stream.pas b/lib/delphi/src/Thrift.Stream.pas index d1f6384..74c1782 100644 --- a/lib/delphi/src/Thrift.Stream.pas +++ b/lib/delphi/src/Thrift.Stream.pas @@ -140,7 +140,7 @@ function TThriftStreamAdapterCOM.ToArray: TBytes; var statstg: TStatStg; len : Integer; - NewPos : Int64; + NewPos : {$IF CompilerVersion >= 30.0} UInt64 {$ELSE} Int64 {$IFEND}; cbRead : Integer; begin FillChar( statstg, SizeOf( statstg), 0); http://git-wip-us.apache.org/repos/asf/thrift/blob/23d67460/lib/delphi/src/Thrift.Transport.pas ---------------------------------------------------------------------- diff --git a/lib/delphi/src/Thrift.Transport.pas b/lib/delphi/src/Thrift.Transport.pas index c485e70..74afb52 100644 --- a/lib/delphi/src/Thrift.Transport.pas +++ b/lib/delphi/src/Thrift.Transport.pas @@ -19,6 +19,11 @@ {$SCOPEDENUMS ON} +{$IF CompilerVersion < 28.0} + {$DEFINE OLD_SOCKETS} // TODO: add socket support for CompilerVersion >= 28.0 +{$IFEND} + + unit Thrift.Transport; interface @@ -27,7 +32,10 @@ uses Classes, SysUtils, Math, - Sockets, WinSock, + WinSock, + {$IFDEF OLD_SOCKETS} + Sockets, + {$ENDIF} Generics.Collections, Thrift.Collections, Thrift.Utils, @@ -151,6 +159,7 @@ type function GetTransport( const ATrans: ITransport): ITransport; virtual; end; + {$IFDEF OLD_SOCKETS} TTcpSocketStreamImpl = class( TThriftStreamImpl ) private type TWaitForData = ( wfd_HaveData, wfd_Timeout, wfd_Error); @@ -173,6 +182,7 @@ type public constructor Create( const ATcpClient: TCustomIpClient; const aTimeout : Integer = 0); end; + {$ENDIF} IStreamTransport = interface( ITransport ) ['{A8479B47-2A3E-4421-A9A0-D5A9EDCC634A}'] @@ -223,6 +233,7 @@ type destructor Destroy; override; end; + {$IFDEF OLD_SOCKETS} TServerSocketImpl = class( TServerTransportImpl) private FServer : TTcpServer; @@ -239,6 +250,7 @@ type procedure Listen; override; procedure Close; override; end; + {$ENDIF} TBufferedTransportImpl = class( TTransportImpl ) private @@ -263,6 +275,7 @@ type property IsOpen: Boolean read GetIsOpen; end; + {$IFDEF OLD_SOCKETS} TSocketImpl = class(TStreamTransportImpl) private FClient : TCustomIpClient; @@ -284,6 +297,7 @@ type property Host : string read FHost; property Port: Integer read FPort; end; + {$ENDIF} TFramedTransportImpl = class( TTransportImpl) private const @@ -531,6 +545,7 @@ end; { TServerSocket } +{$IFDEF OLD_SOCKETS} constructor TServerSocketImpl.Create( const AServer: TTcpServer; AClientTimeout: Integer); begin inherited Create; @@ -727,6 +742,7 @@ begin FInputStream := TTcpSocketStreamImpl.Create( FClient, FTimeout); FOutputStream := FInputStream; end; +{$ENDIF} { TBufferedStream } @@ -1168,6 +1184,7 @@ end; { TTcpSocketStreamImpl } +{$IFDEF OLD_SOCKETS} procedure TTcpSocketStreamImpl.Close; begin FTcpClient.Close; @@ -1385,6 +1402,7 @@ begin FTcpClient.SendBuf( Pointer(@buffer[offset])^, count); end; +{$ENDIF} {$IF CompilerVersion < 21.0} initialization
