From a3bcfc191f1a32fb3970840147a86be61edce46a Mon Sep 17 00:00:00 2001 From: inoussa Date: Sat, 6 Oct 2018 12:14:24 +0000 Subject: [PATCH] Better handling of currency property comparison in "Equal". git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6675 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- wst/trunk/base_service_intf.pas | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/wst/trunk/base_service_intf.pas b/wst/trunk/base_service_intf.pas index 37044ebed..b636afd2c 100644 --- a/wst/trunk/base_service_intf.pas +++ b/wst/trunk/base_service_intf.pas @@ -5276,6 +5276,11 @@ var selfTypeInfo : PTypeInfo; srcObj, dstObj : TObject; ok : Boolean; + currencyA, currencyB : record + case Integer of + 0 : (CurrencyValue : Currency;); + 1 : (Int64Value : Int64;); + end; begin Result := False; if not Assigned(ACompareTo) then @@ -5316,7 +5321,20 @@ begin end; end; tkFloat : - ok := ( GetFloatProp(Self,p^.Name) = GetFloatProp(ACompareTo,p^.Name) ); + begin + case GetTypeData(p^.PropType{$IFDEF WST_DELPHI}^{$ENDIF})^.FloatType of + ftSingle, ftDouble, ftExtended : + ok := (GetFloatProp(Self,p^.Name) = GetFloatProp(ACompareTo,p^.Name)); + ftCurr : + begin + currencyA.CurrencyValue := GetFloatProp(Self,p^.Name); + currencyB.CurrencyValue := GetFloatProp(ACompareTo,p^.Name); + ok := (currencyA.Int64Value = currencyB.Int64Value); + end; + else + ok := (GetFloatProp(Self,p^.Name) = GetFloatProp(ACompareTo,p^.Name)); + end; + end; end; if not ok then Break;