Bläddra i källkod

* adjust ToInteger of the Boolean helpers so that it returns the value of either True or False, but not any other value (e.g. in the *Bool types). This is not only Delphi compatible, but also fixes the compilation problem of the one or other 32-bit platform (like PowerPC) after e65b822a.

Sven Barth 3 år sedan
förälder
incheckning
2636966e2a
1 ändrade filer med 6 tillägg och 1 borttagningar
  1. 6 1
      rtl/objpas/sysutils/syshelpb.inc

+ 6 - 1
rtl/objpas/sysutils/syshelpb.inc

@@ -26,7 +26,12 @@ end;
 Function TBOOLHELPER.ToInteger: Integer; inline;
 
 begin
-  Result:=Integer(Self);
+  { Returns either True or False for the corresponding type, but not e.g. $1234
+    for a WordBool with that value }
+  if Self then
+    Result:=Integer(TBOOLTYPE(True))
+  else
+    Result:=Integer(TBOOLTYPE(False));
 end;
 
 Function TBOOLHELPER.ToString(UseBoolStrs: TUseBoolStrs = TUseBoolStrs.False): string; overload; inline;