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:
@@ -273,9 +273,11 @@ void TextEditor::highlightCurrentLine()
|
||||
if (!isReadOnly()) {
|
||||
QTextEdit::ExtraSelection selection;
|
||||
QColor lineColor = d->colormap[QLatin1String("Current line highlight")];
|
||||
unsigned long col = (lineColor.red() << 24) | (lineColor.green() << 16) | (lineColor.blue() << 8);
|
||||
unsigned int col = (lineColor.red() << 24) | (lineColor.green() << 16) | (lineColor.blue() << 8);
|
||||
ParameterGrp::handle hPrefGrp = getWindowParameter();
|
||||
col = hPrefGrp->GetUnsigned( "Current line highlight", col);
|
||||
unsigned long value = static_cast<unsigned long>(col);
|
||||
value = hPrefGrp->GetUnsigned( "Current line highlight", value);
|
||||
col = static_cast<unsigned int>(value);
|
||||
lineColor.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff);
|
||||
selection.format.setBackground(lineColor);
|
||||
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
@@ -434,8 +436,10 @@ void TextEditor::OnChange(Base::Subject<const char*> &rCaller,const char* sReaso
|
||||
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);
|
||||
if (this->highlighter)
|
||||
this->highlighter->setColor(QLatin1String(sReason), color);
|
||||
|
||||
Reference in New Issue
Block a user