[fpc-pascal] googleapiconv
Michael Van Canneyt
michael at freepascal.org
Mon Aug 22 18:43:29 CEST 2016
On Mon, 22 Aug 2016, Sven Barth wrote:
> Am 22.08.2016 15:16 schrieb "Michael Van Canneyt" <michael at 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 at 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, at i);
{$endif}
// Now, set new length
Michael.
More information about the fpc-pascal
mailing list