[fpc-devel]Bugfix fo writer.inc

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Sep 20 14:25:42 CEST 2002


On Fri, 20 Sep 2002, Mattias Gaertner wrote:

> Hi,
>
> I found a bug in TBinaryObjectWriter.Write (fcl/inc/writer.inc).
> 'Buffer' is not adjusted if FBuffer is full. Diff is attached and here is the proc:
>
>
> procedure TBinaryObjectWriter.Write(const Buffer; Count: LongInt);
> var
>   CopyNow: LongInt;
>   SourceBuf: PChar;
> begin
>   SourceBuf:=@Buffer;
>   while Count > 0 do
>   begin
>     CopyNow := Count;
>     if CopyNow > FBufSize - FBufPos then
>       CopyNow := FBufSize - FBufPos;
>     Move(SourceBuf^, PChar(FBuffer)[FBufPos], CopyNow);
>     Dec(Count, CopyNow);
>     Inc(FBufPos, CopyNow);
>     inc(SourceBuf, CopyNow);
>     if FBufPos = FBufSize then
>       FlushBuffer;
>   end;
> end;

Applied, thanks !

Michael





More information about the fpc-devel mailing list