[fpc-pascal] How to fix - Hint: Type size mismatch

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Nov 4 00:33:39 CET 2006


Hi,

I am trying to clean up the fpGFX code and trying to get rid of all
compiler warnings.
I get the following compiler hint on every line in the RectToXRect
function. Using FPC 2.1.1 under Linux.

Hint: Type size mismatch, possible loss of data / range check error

function RectToXRect(const ARect: TRect): TXRectangle;
begin
  Result.x      := ARect.Left;
  Result.y      := ARect.Top;
  Result.width  := ARect.Right - ARect.Left;
  Result.height := ARect.Bottom - ARect.Top;
end;


I understand the hint, and agree with it, but what do I need to do, to
fix/remove it?  The TRect and TXRectangle are defined as shown below.
Could I cast ARect's fields to remove the hint?

   TXRectangle = record
        x, y : cshort;
        width, height : cushort;
     end;

  TRect =  record
    case Integer of
      0: (Left,Top,Right,Bottom : Longint);
      1: (TopLeft,BottomRight : TPoint);
    end;


Regards,
  - Graeme -

-- 
There's no place like 127.0.0.1



More information about the fpc-pascal mailing list