[lazarus] setposition-seek problem found

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Dec 18 11:35:12 EST 2002


On Wed, 18 Dec 2002 16:58:32 +0100 (CET)
Michael.VanCanneyt at wisa.be wrote:

> 
> 
> On Wed, 18 Dec 2002, Peter Vreman wrote:
> 
> > The problem is not in the compiler but in the FCL:
> >
> > There are 2 seek methods:
> >
> > Seek(int64,TSeekOrigin);
> > Seek(Longint,Word);
> >
> > And in Setposition(int64) is the following code:
> >
> > Seek(pos,soFromBeginning);
> >
> > with soFromBeginning defined as:
> >
> > { TStream seek origins }
> > const
> >   soFromBeginning = 0;

Must be a borland invention ;)


> > And this is an integer value that is not compatible with the TSeekOrigin
> > enumarted type. So the Seek(longint,Word) will be called.
> 
> I have changed it. All compiles with 1.0.7 and 1.1

I found two other bugs. The first is is an unset function result in

  function TStream.Seek(Offset: Int64; Origin: TSeekorigin): Int64;

    begin
      // Backwards compatibility that calls the longint Seek
      if (Offset<Low(longint)) or
         (Offset>High(longint)) then
        raise ERangeError.Create(SRangeError);
      Result:=Seek(longint(Offset),ord(Origin));  
    end;


The other one can destroy xml files. I'm searching ...


Mattias






More information about the Lazarus mailing list