Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-12

patch for ReadPropValue

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darek Mazur

Hi

I investigated read property from Lazarus LRS, and I noticed that tColor property with Identifies don't work and crash program (for example tForm.COLOR:=clWindow)

I write small patch to avoid this

this is new function in CLASSES.INC
// ********************start patch
function GlobalIdentToInt(const Ident: String; var Int: LongInt):boolean;
var
  i : Integer;
begin
  with IntConstList.LockList do
  try
    for i := 0 to Count - 1 do
         if TIntConst(Items[I]).IdentToIntFn(Ident, Int) then exit(True);
    Result := false;
  finally
    IntConstList.UnlockList;
  end;
end;
//  *************stop patch

and changes in READER.INC
in procedure TReader.ReadPropValue(Instance: TPersistent; PropInfo: Pointer);

from:
 case PropType^.Kind of
    tkInteger:
      if FDriver.NextValue = vaIdent then
      begin
        Ident := ReadIdent;
// *************start patch
        if GlobalIdentToInt(Ident,Value) then
          SetOrdProp(Instance, PropInfo, Value)
        else
          raise EReadError.Create(SInvalidPropertyValue);
//  *************stop patch
      end else
        SetOrdProp(Instance, PropInfo, ReadInteger);
    tkBool:
      SetOrdProp(Instance, PropInfo, Ord(ReadBoolean));

with this patch Delphi DFM converted to Lazarus LRS works fine

Darek

Reply by email

Michael Van Canneyt
to Darek Mazur
Darek Mazur wrote 50 lines
Hi I investigated read property from Lazarus LRS, and I noticed that tColor property with Identifies don't work and crash program (for example tForm.COLOR:=clWindow) I write small patch to avoid this this is new function in CLASSES.INC // ********************start patch function GlobalIdentToInt(const Ident: String; var Int: LongInt):boolean; var i : Integer; begin with IntConstList.LockList do try for i := 0 to Count - 1 do if TIntConst(Items[I]).IdentToIntFn(Ident, Int) then exit(True); Result := false; finally IntConstList.UnlockList; end; end; // *************stop patch and changes in READER.INC in procedure TReader.ReadPropValue(Instance: TPersistent; PropInfo: Pointer); from: case PropType^.Kind of tkInteger: if FDriver.NextValue = vaIdent then begin Ident := ReadIdent; // *************start patch if GlobalIdentToInt(Ident,Value) then SetOrdProp(Instance, PropInfo, Value) else raise EReadError.Create(SInvalidPropertyValue); // *************stop patch end else SetOrdProp(Instance, PropInfo, ReadInteger); tkBool: SetOrdProp(Instance, PropInfo, Ord(ReadBoolean)); with this patch Delphi DFM converted to Lazarus LRS works fine

Committed the patch, thank you.

Michael.

Reply by email

Vincent Snijders
Show quoted text 12 lines
Van: Michael Van Canneyt On Sun, 14 Dec 2003, Darek Mazur wrote: > > Hi > > I investigated read property from Lazarus LRS, and I noticed that > tColor property with Identifies don't work and crash program (for > example > tForm.COLOR:=clWindow) > > I write small patch to avoid this

<snipped patch>

Show quoted text 6 lines
> > with this patch Delphi DFM converted to Lazarus LRS works fine Committed the patch, thank you. Michael.

Could you apply this patch to the fixes branch too?

Vincent Snijders.

Reply by email

Unknown author
to Vincent Snijders
Vincent Snijders wrote 22 lines
> Van: Michael Van Canneyt > On Sun, 14 Dec 2003, Darek Mazur wrote: > > > > > Hi > > > > I investigated read property from Lazarus LRS, and I noticed that > > tColor property with Identifies don't work and crash program (for > > example > > tForm.COLOR:=clWindow) > > > > I write small patch to avoid this <snipped patch> > > > > with this patch Delphi DFM converted to Lazarus LRS works fine > > Committed the patch, thank you. > > Michael. Could you apply this patch to the fixes branch too?

There is no fixes branch for the FCL. It is shared between 1.0.X and 1.9.X I've given more details to Micha Nelissen in a private mail.

Michael.

Reply by email