PVS: V629 Consider inspecting the 'col.red() << 24' expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type.

This commit is contained in:
wmayer
2019-02-17 22:27:00 +01:00
parent 2bb5797568
commit f0320d954a
5 changed files with 71 additions and 59 deletions

View File

@@ -514,8 +514,10 @@ void PythonConsole::OnChange( Base::Subject<const char*> &rCaller,const char* sR
QMap<QString, QColor>::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason));
if (it != d->colormap.end()) {
QColor color = it.value();
unsigned long col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
col = hPrefGrp->GetUnsigned( sReason, col);
unsigned int col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
unsigned long value = static_cast<unsigned long>(col);
value = hPrefGrp->GetUnsigned(sReason, value);
col = static_cast<unsigned int>(value);
color.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff);
pythonSyntax->setColor(QString::fromLatin1(sReason), color);
}
@@ -929,10 +931,11 @@ void PythonConsole::changeEvent(QEvent *e)
else if (e->type() == QEvent::StyleChange) {
QPalette pal = palette();
QColor color = pal.windowText().color();
unsigned long text = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
unsigned int text = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
unsigned long value = static_cast<unsigned long>(text);
// if this parameter is not already set use the style's window text color
text = getWindowParameter()->GetUnsigned("Text", text);
getWindowParameter()->SetUnsigned("Text", text);
value = getWindowParameter()->GetUnsigned("Text", value);
getWindowParameter()->SetUnsigned("Text", value);
}
TextEdit::changeEvent(e);
}