* Now ansistring of arbitrary length can be read

This commit is contained in:
michael 1999-07-08 15:18:14 +00:00
parent 3908f00241
commit d753055cfe

View File

@ -711,7 +711,7 @@ Begin
begin
FileFunc(f.InOutFunc)(f);
If f.BufPos>=f.BufEnd Then
break;
break;
end;
p:=@f.Bufptr^[f.BufPos];
if SPos+f.BufEnd-f.BufPos>MaxLen then
@ -765,12 +765,15 @@ var
len : longint;
Begin
{ Delete the string }
AnsiStr_Decr_ref (Pointer(S));
{ We assign room for 1024 characters totally at random.... }
Pointer(s):=Pointer(NewAnsiString(1024));
len:=ReadPCharLen(f,pchar(s),1024);
pchar(pchar(s)+len)^:=#0;
PAnsiRec(Pointer(S)-FirstOff)^.Len:=len;
Setlength(S,0);
Repeat
// SetLength will reallocate the length.
SetLength(S,Length(S)+255);
len:=ReadPCharLen(f,pchar(Pointer(S)+Length(S)-255),255);
If Len<255 then
// Set actual length
SetLength(S,Length(S)-255+Len);
Until len<255;
End;
@ -928,7 +931,10 @@ end;
{
$Log$
Revision 1.49 1999-07-05 20:04:29 peter
Revision 1.50 1999-07-08 15:18:14 michael
* Now ansistring of arbitrary length can be read
Revision 1.49 1999/07/05 20:04:29 peter
* removed temp defines
Revision 1.48 1999/07/01 15:39:52 florian