You are not logged in.
Pages: 1
Hi AB,
sorry but i don't remember how to open a ticket.
The write methof of this object doesn't work well if one want to write before the end of the buffer, changing the stream position to do it.
function TRawByteStringStream.Write(const Buffer; Count: Integer): Longint;
begin
if Count<=0 then
Result := 0 else begin
Result := Count;
SetLength(fDataString,(fPosition+Result));
MoveFast(Buffer,PByteArray(fDataString)[fPosition],Result);
inc(FPosition,Result);
end;
end;
I have made this change and now seems to be right.
// before
SeltLength(fDataString,(fPosition + Result))
//after
if fPosition+Result > Length(fDataString) then SetLength(fDataString,(fPosition+Result));
Offline
No reply , so i opened a ticket...
Result : rejiected because it could break existing code.
I obviously agree wit this concept.
I don't agree with the fact that as is 'well' documented this stream is only for append. There isn't any line in the SAD saying that tRawByteStringStream may not be used as any other one derived from tstream class.
Offline
This class mimics TStringStream in this respect:
Use Write to replace the end of the string from the current position on with the first Count bytes of Buffer. Write will change the Size property to reflect the new length of the DataString.
But the confusion was indeed understandable.
I updated the class description.
Offline
Pages: 1