Terminal: Fix -Wtautological-constant-out-of-range-compare
Since index's type is uint8 (range 0-255) and kTermColorCount set to 256 (declared in terminal/Colors.h at line 31), 'index < kTermColorCount' is always true. Pointed out by clang. Change-Id: I49e45cbd8a55223177fd2d6a64a0e37cf6341fc7 Reviewed-on: https://review.haiku-os.org/637 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
81508f30d0
commit
85477b7896
@@ -1781,9 +1781,8 @@ TermView::MessageReceived(BMessage *msg)
|
|||||||
if (msg->FindUInt8("index", i, &index) != B_OK)
|
if (msg->FindUInt8("index", i, &index) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (index < kTermColorCount)
|
SetTermColor(index,
|
||||||
SetTermColor(index,
|
TermApp::DefaultPalette()[index], dynamic);
|
||||||
TermApp::DefaultPalette()[index], dynamic);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,15 +231,14 @@ TerminalBuffer::SetCursorHidden(bool hidden)
|
|||||||
void
|
void
|
||||||
TerminalBuffer::SetPaletteColor(uint8 index, rgb_color color)
|
TerminalBuffer::SetPaletteColor(uint8 index, rgb_color color)
|
||||||
{
|
{
|
||||||
if (index < kTermColorCount)
|
fColorsPalette[index] = color;
|
||||||
fColorsPalette[index] = color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rgb_color
|
rgb_color
|
||||||
TerminalBuffer::PaletteColor(uint8 index)
|
TerminalBuffer::PaletteColor(uint8 index)
|
||||||
{
|
{
|
||||||
return fColorsPalette[min_c(index, kTermColorCount - 1)];
|
return fColorsPalette[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user