Roland Turcan pisze:
> Hello Bart and others,
> 
> Thanks for your kindness to test my test case, which works fine in my
> case too, but I have found something what maybe more explain my
> problem.
> 
> TYPE TSomeItem = RECORD
>                    First :single;
>                    Second:Single;
>                    Third :integer;
> 
> TYPE TSomethingArr = ARRAY OF TSomeItem;
> 
> TYPE TSomeHeader   =RECORD
>                       ...
>                     end;
> 
> TYPE TMyObject =class
>                  private
>                    FHeader:TSomeHeader;
>                    FItems :TSomethingArr;
> 
> ...
> 
> FUNCTION TMyObject.LoadFromStream (Stream:TStream):BOOLEAN;
> ...
>   SetLength (FItems, 0); //!! for testing only -- this line works fine
>   Stream.Read (FHeader, HeaderLen);
>   SetLength (FItems, 0); //!! for testing only -- this line raises an 
> exception
> END;
> 
> 
> If you see the declaration of TMyObject you will find that FHeader
> declaration is followed by FItems and the length of read memory block
> goes over size of FHeader and it affects FItems.
> 
> Hm?
> 
> TRoland;


How is HeaderLen declared ?

Boguslaw


_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to