THRIFT-5764 Extra CTOR for TThriftBytesImpl
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/src/Thrift.Protocol.pas b/lib/delphi/src/Thrift.Protocol.pas
index f5cb454..4c02d3f 100644
--- a/lib/delphi/src/Thrift.Protocol.pas
+++ b/lib/delphi/src/Thrift.Protocol.pas
@@ -28,6 +28,7 @@
Classes,
SysUtils,
Contnrs,
+ Math,
Thrift.Exception,
Thrift.Stream,
Thrift.Utils,
@@ -388,6 +389,7 @@
constructor Create; overload;
constructor Create( const bytes : TBytes); overload;
constructor Create( var bytes : TBytes; const aTakeOwnership : Boolean = FALSE); overload;
+ constructor Create( const pData : Pointer; const nCount : Integer); overload;
function ToString : string; override;
end;
@@ -802,6 +804,13 @@
end;
+constructor TThriftBytesImpl.Create( const pData : Pointer; const nCount : Integer);
+begin
+ SetLength(FData, Max(nCount,0));
+ if Length(FData) > 0 then Move( pData^, FData[0], Length(FData));
+end;
+
+
function TThriftBytesImpl.ToString : string;
var sb : TThriftStringBuilder;
begin