Commit 29382cc6 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Fix readability-implicit-bool-cast issues

parent 7351427f
...@@ -1305,7 +1305,7 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte ...@@ -1305,7 +1305,7 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, option.widget); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, option.widget);
// Draw name // Draw name
QPalette::ColorRole textColor = (option.state & QStyle::State_Selected) ? QPalette::ColorRole textColor = ((option.state & QStyle::State_Selected) != 0) ?
QPalette::HighlightedText: QPalette::Text; QPalette::HighlightedText: QPalette::Text;
painter->setPen(option.palette.color(textColor)); painter->setPen(option.palette.color(textColor));
painter->setFont(option.font); painter->setFont(option.font);
......
...@@ -89,7 +89,7 @@ KeyboardTranslatorReader::KeyboardTranslatorReader(QIODevice* source) ...@@ -89,7 +89,7 @@ KeyboardTranslatorReader::KeyboardTranslatorReader(QIODevice* source)
: _source(source) : _source(source)
, _description(QString()) , _description(QString())
, _nextEntry() , _nextEntry()
, _hasNext(0) , _hasNext(false)
{ {
// read input until we find the description // read input until we find the description
while (_description.isEmpty() && !source->atEnd()) { while (_description.isEmpty() && !source->atEnd()) {
......
This diff is collapsed.
...@@ -234,16 +234,16 @@ void Vt102Emulation::initTokenizer() ...@@ -234,16 +234,16 @@ void Vt102Emulation::initTokenizer()
charClass[i] |= CTL; charClass[i] |= CTL;
for (i = 32; i < 256; ++i) for (i = 32; i < 256; ++i)
charClass[i] |= CHR; charClass[i] |= CHR;
for (s = (quint8*)"@ABCDGHILMPSTXZcdfry"; *s; ++s) for (s = (quint8*)"@ABCDGHILMPSTXZcdfry"; *s != 0u; ++s)
charClass[*s] |= CPN; charClass[*s] |= CPN;
// resize = \e[8;<row>;<col>t // resize = \e[8;<row>;<col>t
for (s = (quint8*)"t"; *s; ++s) for (s = (quint8*)"t"; *s != 0u; ++s)
charClass[*s] |= CPS; charClass[*s] |= CPS;
for (s = (quint8*)"0123456789"; *s; ++s) for (s = (quint8*)"0123456789"; *s != 0u; ++s)
charClass[*s] |= DIG; charClass[*s] |= DIG;
for (s = (quint8*)"()+*%"; *s; ++s) for (s = (quint8*)"()+*%"; *s != 0u; ++s)
charClass[*s] |= SCS; charClass[*s] |= SCS;
for (s = (quint8*)"()+*#[]%"; *s; ++s) for (s = (quint8*)"()+*#[]%"; *s != 0u; ++s)
charClass[*s] |= GRP; charClass[*s] |= GRP;
resetTokenizer(); resetTokenizer();
...@@ -1020,11 +1020,11 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent* event) ...@@ -1020,11 +1020,11 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent* event)
if (getMode(MODE_Ansi)) states |= KeyboardTranslator::AnsiState; if (getMode(MODE_Ansi)) states |= KeyboardTranslator::AnsiState;
if (getMode(MODE_AppCuKeys)) states |= KeyboardTranslator::CursorKeysState; if (getMode(MODE_AppCuKeys)) states |= KeyboardTranslator::CursorKeysState;
if (getMode(MODE_AppScreen)) states |= KeyboardTranslator::AlternateScreenState; if (getMode(MODE_AppScreen)) states |= KeyboardTranslator::AlternateScreenState;
if (getMode(MODE_AppKeyPad) && (modifiers & Qt::KeypadModifier)) if (getMode(MODE_AppKeyPad) && ((modifiers & Qt::KeypadModifier) != 0u))
states |= KeyboardTranslator::ApplicationKeypadState; states |= KeyboardTranslator::ApplicationKeypadState;
// check flow control state // check flow control state
if (modifiers & Qt::ControlModifier) { if (modifiers & Qt::ControlModifier != 0u) {
switch (event->key()) { switch (event->key()) {
case Qt::Key_S: case Qt::Key_S:
emit flowControlKeyPressed(true); emit flowControlKeyPressed(true);
...@@ -1050,17 +1050,17 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent* event) ...@@ -1050,17 +1050,17 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent* event)
// Alt+[Character] results in Esc+[Character] being sent // Alt+[Character] results in Esc+[Character] being sent
// (unless there is an entry defined for this particular combination // (unless there is an entry defined for this particular combination
// in the keyboard modifier) // in the keyboard modifier)
const bool wantsAltModifier = entry.modifiers() & entry.modifierMask() & Qt::AltModifier; const bool wantsAltModifier = entry.modifiers() & entry.modifierMask() & Qt::AltModifier != 0u;
const bool wantsMetaModifier = entry.modifiers() & entry.modifierMask() & Qt::MetaModifier; const bool wantsMetaModifier = entry.modifiers() & entry.modifierMask() & Qt::MetaModifier != 0u;
const bool wantsAnyModifier = entry.state() & const bool wantsAnyModifier = entry.state() &
entry.stateMask() & KeyboardTranslator::AnyModifierState; entry.stateMask() & KeyboardTranslator::AnyModifierState != 0;
if ( modifiers & Qt::AltModifier && !(wantsAltModifier || wantsAnyModifier) if ( (modifiers & Qt::AltModifier != 0u) && !(wantsAltModifier || wantsAnyModifier)
&& !event->text().isEmpty() ) && !event->text().isEmpty() )
{ {
textToSend.prepend("\033"); textToSend.prepend("\033");
} }
if ( modifiers & Qt::MetaModifier && !(wantsMetaModifier || wantsAnyModifier) if ( (modifiers & Qt::MetaModifier != 0u) && !(wantsMetaModifier || wantsAnyModifier)
&& !event->text().isEmpty() ) && !event->text().isEmpty() )
{ {
textToSend.prepend("\030@s"); textToSend.prepend("\030@s");
...@@ -1070,20 +1070,20 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent* event) ...@@ -1070,20 +1070,20 @@ void Vt102Emulation::sendKeyEvent(QKeyEvent* event)
{ {
TerminalDisplay * currentView = _currentScreen->currentTerminalDisplay(); TerminalDisplay * currentView = _currentScreen->currentTerminalDisplay();
if (entry.command() & KeyboardTranslator::EraseCommand) { if ((entry.command() & KeyboardTranslator::EraseCommand) != 0) {
textToSend += eraseChar(); textToSend += eraseChar();
} else if (entry.command() & KeyboardTranslator::ScrollPageUpCommand) } else if ((entry.command() & KeyboardTranslator::ScrollPageUpCommand) != 0)
currentView->scrollScreenWindow(ScreenWindow::ScrollPages, -1); currentView->scrollScreenWindow(ScreenWindow::ScrollPages, -1);
else if (entry.command() & KeyboardTranslator::ScrollPageDownCommand) else if ((entry.command() & KeyboardTranslator::ScrollPageDownCommand) != 0)
currentView->scrollScreenWindow(ScreenWindow::ScrollPages, 1); currentView->scrollScreenWindow(ScreenWindow::ScrollPages, 1);
else if (entry.command() & KeyboardTranslator::ScrollLineUpCommand) else if ((entry.command() & KeyboardTranslator::ScrollLineUpCommand) != 0)
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, -1); currentView->scrollScreenWindow(ScreenWindow::ScrollLines, -1);
else if (entry.command() & KeyboardTranslator::ScrollLineDownCommand) else if ((entry.command() & KeyboardTranslator::ScrollLineDownCommand) != 0)
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, 1); currentView->scrollScreenWindow(ScreenWindow::ScrollLines, 1);
else if (entry.command() & KeyboardTranslator::ScrollUpToTopCommand) else if ((entry.command() & KeyboardTranslator::ScrollUpToTopCommand) != 0)
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, currentView->scrollScreenWindow(ScreenWindow::ScrollLines,
- currentView->screenWindow()->currentLine()); - currentView->screenWindow()->currentLine());
else if (entry.command() & KeyboardTranslator::ScrollDownToBottomCommand) else if ((entry.command() & KeyboardTranslator::ScrollDownToBottomCommand) != 0)
currentView->scrollScreenWindow(ScreenWindow::ScrollLines, lineCount()); currentView->scrollScreenWindow(ScreenWindow::ScrollLines, lineCount());
} }
else if (!entry.text().isEmpty()) else if (!entry.text().isEmpty())
......
...@@ -198,13 +198,13 @@ int KONSOLEPRIVATE_EXPORT konsole_wcwidth(quint16 oucs) ...@@ -198,13 +198,13 @@ int KONSOLEPRIVATE_EXPORT konsole_wcwidth(quint16 oucs)
/* binary search in table of non-spacing characters */ /* binary search in table of non-spacing characters */
if (bisearch(ucs, combining, if (bisearch(ucs, combining,
sizeof(combining) / sizeof(struct interval) - 1)) sizeof(combining) / sizeof(struct interval) - 1) != 0)
return 0; return 0;
/* if we arrive here, ucs is not a combining or C0/C1 control character */ /* if we arrive here, ucs is not a combining or C0/C1 control character */
return 1 + return 1 +
(ucs >= 0x1100 && static_cast<int>(ucs >= 0x1100 &&
(ucs <= 0x115f || /* Hangul Jamo init. consonants */ (ucs <= 0x115f || /* Hangul Jamo init. consonants */
ucs == 0x2329 || ucs == 0x232a || ucs == 0x2329 || ucs == 0x232a ||
(ucs >= 0x2e80 && ucs <= 0xa4cf && (ucs >= 0x2e80 && ucs <= 0xa4cf &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment