On Mon, 22 Aug 2016, Sven Barth wrote:

Am 22.08.2016 15:16 schrieb "Michael Van Canneyt" <mich...@freepascal.org>:



On Mon, 22 Aug 2016, Dave Connolly wrote:

From what I can see the error seems to involve these two lines in the

procedure TBaseObject.SetObjectProperty(P: PPropInfo; AValue:
TJSONObject);
in restbase.pp (fcl-web)

   PA:=@(pdynarraytypeinfo(P^.PropType)^.elesize)+i;
   PA:=@(pdynarraytypeinfo(P^.PropType)^.eletype)+i;


   AN:=PTYpeInfo(PA^)^.Name;

In my scenario the PTYpeInfo(PA^)^.Name is "t???/t???/t???/t0t@0t"

FPC 3.1.1 revision 34368


I suspect this has to do with the additional level of indirection added by
Sven Barth. I will need to check that.

Best don't use pdynarraytypeinfo as that doesn't correctly handle alignment
either, use PTypeData instead.


So what should this be changed to:

    i:=Length(P^.PropType^.name);
    PA:=@(pdynarraytypeinfo(P^.PropType)^.eletype)+i;
    ET:=PTYpeInfo(PA^);
    if (ET^.Kind=tkClass) then
      begin
      // get object type name
      AN:=ET^.Name;
      // Free all objects
      O:=TObjectArray(AP);
      For I:=0 to Length(O)-1 do
        FreeAndNil(O[i]);
      end;
    // Clear array
{$ifdef ver2_6}
    LPN:=Lowercase(P^.Name);
    SetArrayLength(LPN,0);
{$else}
    I:=0;
    DynArraySetLength(AP,P^.PropType,1,@i);
{$endif}
    // Now, set new length



Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to