THRIFT-1537:TFramedTransport issues
Client: delphi
Patch: Jens Geyer
TFramedTransport fixes for:
- The offset "off" is ignored, instead always 0 is used fpor reads and writes
- Trying to write an empty byte array results in range check exceptions
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1303637 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/delphi/src/Thrift.Protocol.pas b/lib/delphi/src/Thrift.Protocol.pas
index 82c58b1..a54008f 100644
--- a/lib/delphi/src/Thrift.Protocol.pas
+++ b/lib/delphi/src/Thrift.Protocol.pas
@@ -972,9 +972,11 @@
end;
procedure TBinaryProtocolImpl.WriteBinary( const b: TBytes);
+var iLen : Integer;
begin
- WriteI32( Length(b));
- FTrans.Write(b, 0, Length( b));
+ iLen := Length(b);
+ WriteI32( iLen);
+ if iLen > 0 then FTrans.Write(b, 0, iLen);
end;
procedure TBinaryProtocolImpl.WriteBool(b: Boolean);