[fpc-pascal] fpreport rangeerrors with TFPReportColor

Andreas Frieß friess at gmx.at
Wed Feb 21 09:48:31 CET 2018


when i compile in Lazarus the Reportdesigner with activated RangeCheck 
it gives a lot of runtimeerror with rangeerrors.

The definition is TFPReportColor  = type UInt32;

Loading and saving in JSON is done by

function ReadInteger(AName: String; ADefault: Integer): Integer; override;
function WriteInteger(AName: String; ADefault: Integer): Integer; override;

internally of write and read there is a cast from d.AsInt64 to integer.

This means you have at reading a AsInt64 -> Integer -> UInt32. Actual i 
have a value of  2147483648 ($‭80000000‬) wich make a rangecheckerror :-)

Should the definition for TFPReportColor not better TFPColor ( I KNOW 
THE DIFFENCES) or QWord with the according routines. Because UInt32 is 
not a JSON dataformat. Integer seems to be to small, so QWord fits this 
better. TFPColor is more FPC-Compatible (with the overhead of the needed 
conversions).

I am wrong ?

Andreas





More information about the fpc-pascal mailing list