You are not logged in.
Pages: 1
JSON mORMot2 Delphi 7 Access Violation in mormot.core.base
function FindNonVoidRawUtf8I(n: PPointerArray; name: pointer; len: TStrLen; count: PtrInt): PtrInt;
line 5:
if (PStrLen(p1 - _STRLEN)^ = len) and // same length
((ord(p1^) xor ord(p2^)) and $df = 0) then // same first char
for this code:
Var Data: Variant;
Begin
TDocVariant.New(Data);
Data.Sale:= _Obj([]);
Data.Sale.Id:= '100';
Data.Sale.Number:= '10';
Data.Sale.Invoice:= _Obj([]);
Data.Sale.Invoice.Client:= StringToUtf8('José'); // Access Violation
...
The same code works fine in Delphi 10.2
I understand that I should not use Delphi 7, but I am not allowed to migrate the project to a newer version of Delphi.
I also know that there are other ways to generate the JSON, but in my case if conditions must be added to evaluate at runtime what data to add or not to add to the JSON.
I am grateful for any help you can give me
Offline
Thank you so much.
This is the line that generates the access violation in Delphi 7:
Data.Sale.Invoice:= _Obj([]);
And it is solved if it is replaced by this line:
DocVariantData(Data.Sale).O_['Invoice'];
Last edited by Esequias (2025-05-03 05:28:03)
Offline
Pages: 1