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 <pulkomandy@pulkomandy.tk>
This commit is contained in:
Murai Takashi 2018-10-21 08:19:03 +09:00 committed by Jérôme Duval
parent 81508f30d0
commit 85477b7896
2 changed files with 4 additions and 6 deletions

View File

@ -1781,7 +1781,6 @@ TermView::MessageReceived(BMessage *msg)
if (msg->FindUInt8("index", i, &index) != B_OK)
break;
if (index < kTermColorCount)
SetTermColor(index,
TermApp::DefaultPalette()[index], dynamic);
}

View File

@ -231,7 +231,6 @@ TerminalBuffer::SetCursorHidden(bool hidden)
void
TerminalBuffer::SetPaletteColor(uint8 index, rgb_color color)
{
if (index < kTermColorCount)
fColorsPalette[index] = color;
}
@ -239,7 +238,7 @@ TerminalBuffer::SetPaletteColor(uint8 index, rgb_color color)
rgb_color
TerminalBuffer::PaletteColor(uint8 index)
{
return fColorsPalette[min_c(index, kTermColorCount - 1)];
return fColorsPalette[index];
}