[fpc-devel] [Fwd: TMemDataset : pb & suggestions]

Oro06 orinaudo at gmail.com
Sat Oct 7 18:14:16 CEST 2006


it seems that using move func give better results.

replacing this

function TMemDataset.GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;
begin
  Result:=PRecInfo(Buffer+FRecInfoOffset)^.BookmarkFlag;
end;

by this :

function TMemDataset.GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;
var ARecInfo: TMTRecInfo;
begin
  Move(PRecInfo(Buffer+FRecInfoOffset)^,ARecInfo,FRecInfoSize);
  Result:=ARecInfo.BookmarkFlag;
end;

same for TMemDataset.SetBookmarkFlag...

procedure TMemDataset.SetBookmarkFlag(Buffer: PChar; Value: TBookmarkFlag);
var APRecInfo: PRecInfo;
    ARecInfo: TMTRecInfo;
begin
  //Unaligned(PRecInfo(Buffer+FRecInfoOffset)^).BookmarkFlag := Value;
  APRecInfo:=PREcInfo(Buffer+FRecInfoOffset);
  Move(APRecInfo^,ARecInfo,FRecInfoSize);
  ARecInfo.BookmarkFlag:=Value;
  Move(ARecInfo,APRecInfo^,FRecInfoSize);
end;

regards
or



More information about the fpc-devel mailing list