[fpc-pascal] fpreport rangeerrors with TFPReportColor
Andreas Frieß
friess at gmx.at
Wed Feb 21 15:00:30 CET 2018
Andreas Frieß wrote:
> when i compile in Lazarus the Reportdesigner with activated
> RangeCheck it gives a lot of runtimeerror with rangeerrors.
>
For explanation what i mean in my previous post, UInt32 is not an
integer or JSON compatible size (and actual rangecheck unsafe).
ANdreas
----------------------
in systemh.inc
maxLongint = $7fffffff;
in objectpas.pp
const
MaxInt = MaxLongint;
type
Integer = longint;
in fpreport.pp
TFPReportColor = type UInt32;
in systemh.inc
Cardinal = LongWord;
...
UInt32 = Cardinal;
in fpreport.pp
const
{ The format is always RRGGBB (Red, Green, Blue) - no alpha channel }
clNone = TFPReportColor($80000000); // a special condition:
$80 00 00 00
......
AWriter.WriteInteger('FontColor', Font.Color);
.....
Font.Color := AReader.ReadInteger('FontColor', Font.Color);
......
in fpReportStreamer.pp
function TFPReportJSONStreamer.ReadInteger(AName: String; ADefault:
Integer): Integer;
var
d: TJSONData;
begin
d := FindChild(AName) as TJSONData;
if d = nil then
Result := ADefault
else
begin
if d.JSONType = jtNumber then
Result := d.AsInt64
else
Result := ADefault;
end;
end;
More information about the fpc-pascal
mailing list