Cocoa: Fix arithmetic overflow in TabControl

This commit is contained in:
rich2014 2024-05-03 23:22:10 +08:00
parent cf53186c8e
commit 3670e936f8
2 changed files with 5 additions and 5 deletions

View File

@ -297,7 +297,7 @@ begin
lw := 0;
SetLength(lwid, arr.count);
for i := 0 to arr.count - 1 do
for i := 0 to Integer(arr.count) - 1 do
begin
vi := NSTabViewItem( arr.objectAtIndex(i) );
sz := vi.sizeOfLabel(false);
@ -948,10 +948,10 @@ var
currentIndex: Integer;
begin
currentIndex := _tabControl.currentIndex;
if currentIndex = _tabControl.fulltabs.count - 1 then
if currentIndex = Integer(_tabControl.fulltabs.count) - 1 then
Exit;
if shouldSpeedUp() then
currentIndex := _tabControl.fulltabs.count - 1
currentIndex := Integer(_tabControl.fulltabs.count) - 1
else
inc(currentIndex);
_tabControl.extselectTabViewItemAtIndex(currentIndex);

View File

@ -860,7 +860,7 @@ begin
ofs := (tr.Right - tr.Left - mw) / length(w);
x := tr.Left;
for i := 0 to idx-1 do
for i := 0 to Integer(idx)-1 do
x := x+ofs+w[i];
Result.Left := Round(x);
@ -882,7 +882,7 @@ begin
ofs := (tr.Bottom - tr.Top - mw) / length(w);
x := tr.Top;
for i := 0 to idx-1 do
for i := 0 to Integer(idx)-1 do
x := x+ofs+w[i];
Result.Left := tr.Left;