#1 2012-05-17 15:48:08

yurasek
Member
From: Belarus
Registered: 2011-04-19
Posts: 18

Small error in TInterfacedObjectFake.FakeCall

I found a small error when working with TDateTime in the implementation of the method TInterfacedObjectFake.FakeCall (unit SQLite3Commons)

Current version

function TInterfacedObjectFake.FakeCall(var aCall: TFakeCallStack): Int64;
{...}
begin
{...}
      if ValueDirection=smdResult then
      case ValueType of // ordinal/real result values to CPU/FPU registers
      smvBoolean..smvInt64: Move(V^,result,SizeInStorage);   // al/ax/eax/eax:edx
      smvDouble:   asm mov eax,V; fld  qword ptr [eax] end;  // in st(0)
      smvCurrency: asm mov eax,V; fild qword ptr [eax] end;  // in st(0)
      end;
    end;
  end;
end;

Corrected version

function TInterfacedObjectFake.FakeCall(var aCall: TFakeCallStack): Int64;
{...}
begin
{...}
      if ValueDirection=smdResult then
      case ValueType of // ordinal/real result values to CPU/FPU registers
      smvBoolean..smvInt64: Move(V^,result,SizeInStorage);   // al/ax/eax/eax:edx
      smvDouble, smvDateTime: asm mov eax,V; fld  qword ptr [eax] end;  // in st(0)
      smvCurrency: asm mov eax,V; fild qword ptr [eax] end;  // in st(0)
      end;
    end;
  end;
end;

Offline

#2 2012-05-17 16:36:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Small error in TInterfacedObjectFake.FakeCall

You're right.

I have fixed this issue in client side fake interface creation, when returning a DateTime kind of value.
See http://synopse.info/fossil/info/e0ff26f3fc

Nice catch!
Thanks for the feedback.

Offline

Board footer

Powered by FluxBB