Carbon: fixed various rangecheck errors.patch by Ludo Brands. issue #19177

git-svn-id: trunk@31541 -
This commit is contained in:
zeljko 2011-07-03 13:58:37 +00:00
parent 63e915c3b0
commit 1a2fe11014
5 changed files with 29 additions and 20 deletions

View File

@ -581,8 +581,9 @@ function TCarbonClipboard.GetOwnerShip(ClipboardType: TClipboardType;
end;
end
else
AddData(FFormats[Formats[I]], CFDataCreate(nil, @DataStream.DataString[1],
DataStream.Size));
if DataStream.Size>0 then
AddData(FFormats[Formats[I]], CFDataCreate(nil, @DataStream.DataString[1],
DataStream.Size));
end;
DataStream.Free;

View File

@ -889,7 +889,8 @@ var
begin
// keep copy of text
FTextBuffer := UTF8ToUTF16(Text);
if Text='' then
FTextBuffer:=#0#0;
TextStyle := Font.Style;
// create text layout
@ -1555,10 +1556,10 @@ begin
FBitmap := nil;
case ALogBrush.lbStyle of
BS_SOLID:
inherited Create(ColorToRGB(ALogBrush.lbColor), True, False);
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), True, False);
BS_HATCHED: // Hatched brush.
begin
inherited Create(ColorToRGB(ALogBrush.lbColor), True, False);
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), True, False);
SetHatchStyle(ALogBrush.lbHatch);
end;
BS_DIBPATTERN,
@ -1567,11 +1568,11 @@ begin
BS_PATTERN,
BS_PATTERN8X8:
begin
inherited Create(ColorToRGB(ALogBrush.lbColor), False, False);
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), False, False);
SetBitmap(TCarbonBitmap(ALogBrush.lbHatch));
end
else
inherited Create(ColorToRGB(ALogBrush.lbColor), False, False);
inherited Create(ColorToRGB(TColor(ALogBrush.lbColor)), False, False);
end;
end;
@ -1660,12 +1661,12 @@ begin
PS_SOLID..PS_DASHDOTDOT,
PS_INSIDEFRAME:
begin
inherited Create(ColorToRGB(ALogPen.lopnColor), True, False);
inherited Create(ColorToRGB(TColor(ALogPen.lopnColor)), True, False);
FWidth := Max(1, ALogPen.lopnWidth.x);
end;
else
begin
inherited Create(ColorToRGB(ALogPen.lopnColor), False, False);
inherited Create(ColorToRGB(TColor(ALogPen.lopnColor)), False, False);
FWidth := 1;
end;
end;
@ -1681,11 +1682,11 @@ begin
PS_SOLID..PS_DASHDOTDOT,
PS_USERSTYLE:
begin
inherited Create(ColorToRGB(lplb.lbColor), True, False);
inherited Create(ColorToRGB(TColor(lplb.lbColor)), True, False);
end;
else
begin
inherited Create(ColorToRGB(lplb.lbColor), False, False);
inherited Create(ColorToRGB(TColor(lplb.lbColor)), False, False);
end;
end;

View File

@ -225,7 +225,8 @@ begin
FillChar(Msg, SizeOf(Msg), 0);
Msg.msg := LM_ACTIVATE;
CarbonMenu.LCLMenuItem.Dispatch(Msg);
CarbonMenu.Parent.Dismissed:=0;
if assigned(CarbonMenu.Parent) then // if parent not closed
CarbonMenu.Parent.Dismissed:=0;
Result := noErr;
Exit;
end else

View File

@ -924,8 +924,11 @@ end;
------------------------------------------------------------------------------}
procedure TCarbonTabsControl.ScrollTabsLeft;
begin
Dec(FFirstIndex);
UpdateTabs;
if FFirstIndex > 0 then
begin
Dec(FFirstIndex);
UpdateTabs;
end;
end;
{------------------------------------------------------------------------------
@ -933,8 +936,11 @@ end;
------------------------------------------------------------------------------}
procedure TCarbonTabsControl.ScrollTabsRight;
begin
Inc(FLastIndex);
UpdateTabs(True);
if FFirstIndex < FTabs.Count - 1 then
begin
Inc(FLastIndex);
UpdateTabs(True);
end;
end;
procedure TCarbonTabsControl.StartScrollingTabsLeft;

View File

@ -3102,8 +3102,8 @@ begin
if not CheckDC(DC, 'SetBkColor') then Exit;
Result := TCarbonDeviceContext(DC).BkColor;
TCarbonDeviceContext(DC).BkColor := Color;
Result := TColorRef(TCarbonDeviceContext(DC).BkColor);
TCarbonDeviceContext(DC).BkColor := TColor(Color);
end;
{------------------------------------------------------------------------------
@ -3445,8 +3445,8 @@ begin
if not CheckDC(DC, 'SetTextColor') then Exit;
Result := TCarbonDeviceContext(DC).TextColor;
TCarbonDeviceContext(DC).TextColor := Color;
Result := TColorRef(TCarbonDeviceContext(DC).TextColor);
TCarbonDeviceContext(DC).TextColor := TColor(Color);
end;
function TCarbonWidgetSet.SetViewPortOrgEx(DC: HDC; NewX, NewY: Integer;