LCL: TLMMouse.Keys:PtrInt becomes TLMMouse.Keys: PtrUInt to avoid range check errors.

Qt, Gtk2: added various type casts to avoid range check errors. Patches by Juha Manninen. fixes #17531

git-svn-id: trunk@27786 -
This commit is contained in:
zeljko 2010-10-21 10:32:41 +00:00
parent 16f53a6e50
commit 28632554b9
3 changed files with 15 additions and 15 deletions

View File

@ -127,14 +127,14 @@ begin
if ItemIndex < 0 then
ItemIndex := 0;
MeasureItemStruct.itemID := ItemIndex;
MeasureItemStruct.itemWidth := width^;
MeasureItemStruct.itemHeight := height^;
MeasureItemStruct.itemID := UINT(ItemIndex);
MeasureItemStruct.itemWidth := UINT(width^);
MeasureItemStruct.itemHeight := UINT(height^);
Msg.Msg := LM_MEASUREITEM;
Msg.MeasureItemStruct := @MeasureItemStruct;
DeliverMessage(AWinControl, Msg);
width^ := MeasureItemStruct.itemWidth;
height^ := MeasureItemStruct.itemHeight;
width^ := gint(MeasureItemStruct.itemWidth);
height^ := gint(MeasureItemStruct.itemHeight);
end;
function GtkCellRendererStateToListViewDrawState(CellState: TGtkCellRendererState): TCustomDrawState;
@ -271,7 +271,7 @@ begin
try
FillChar(Msg.DrawListItemStruct^,SizeOf(TDrawListItemStruct),0);
with Msg.DrawListItemStruct^ do begin
ItemID:=ItemIndex;
ItemID:=UINT(ItemIndex);
Area:=AreaRect;
//DebugLn(['LCLIntfCellRenderer_Render Widget=',GetWidgetDebugReport(Widget^.parent),' Area=',dbgs(Area)]);
DCWidget:=Widget;

View File

@ -7687,7 +7687,7 @@ begin
dec(R.Bottom);
QPainter_setClipRect(TQTDeviceContext(Msg.DC).Widget, @R);
DrawStruct.ItemID := CurrIndex;
DrawStruct.ItemID := UINT(CurrIndex);
DrawStruct.Area := R;
DrawStruct.DC := Msg.DC;
@ -8811,7 +8811,7 @@ var
begin
QPainter_save(painter);
State := QStyleOption_state(option);
DrawStruct.ItemID := QModelIndex_row(index);
DrawStruct.ItemID := UINT(QModelIndex_row(index));
DrawStruct.Area := visualRect(index);
DrawStruct.DC := HDC(TQtDeviceContext.CreateFromPainter(painter));
@ -11029,7 +11029,7 @@ begin
QPaintEvent_Rect(QPaintEventH(Event), ClipRect);
end;
ItemStruct^.itemID := ID;
ItemStruct^.itemID := UINT(ID);
ItemStruct^._hDC := BeginPaint(THandle(Self), AStruct);
FContext := ItemStruct^._hDC;
ItemStruct^.rcItem := PaintData.ClipRect^;
@ -12593,14 +12593,14 @@ var
Msg: TLMMeasureItem;
MeasureItemStruct: TMeasureItemStruct;
begin
MeasureItemStruct.itemID := QModelIndex_row(index);
MeasureItemStruct.itemWidth := Size^.cx;
MeasureItemStruct.itemHeight := Size^.cy;
MeasureItemStruct.itemID := UINT(QModelIndex_row(index));
MeasureItemStruct.itemWidth := UINT(Size^.cx);
MeasureItemStruct.itemHeight := UINT(Size^.cy);
Msg.Msg := LM_MEASUREITEM;
Msg.MeasureItemStruct := @MeasureItemStruct;
DeliverMessage(Msg);
Size^.cx := MeasureItemStruct.itemWidth;
Size^.cy := MeasureItemStruct.itemHeight;
Size^.cx := Longint(MeasureItemStruct.itemWidth);
Size^.cy := Longint(MeasureItemStruct.itemHeight);
end;
procedure TQtAbstractItemView.ItemDelegatePaint(painter: QPainterH;

View File

@ -433,7 +433,7 @@ type
TLMMouse = record
Msg : Cardinal;
Keys: PtrInt;
Keys: PtrUInt;
case Integer of
0: (
XPos: SmallInt;