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:
@@ -429,12 +429,14 @@ void PrefColorButton::restorePreferences()
|
||||
|
||||
QColor col = color();
|
||||
|
||||
unsigned long lcol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
|
||||
unsigned int icol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
|
||||
|
||||
unsigned long lcol = static_cast<unsigned long>(icol);
|
||||
lcol = getWindowParameter()->GetUnsigned( entryName(), lcol );
|
||||
int r = (lcol >> 24)&0xff;
|
||||
int g = (lcol >> 16)&0xff;
|
||||
int b = (lcol >> 8)&0xff;
|
||||
icol = static_cast<unsigned int>(lcol);
|
||||
int r = (icol >> 24)&0xff;
|
||||
int g = (icol >> 16)&0xff;
|
||||
int b = (icol >> 8)&0xff;
|
||||
|
||||
setColor(QColor(r,g,b));
|
||||
}
|
||||
@@ -449,9 +451,8 @@ void PrefColorButton::savePreferences()
|
||||
|
||||
QColor col = color();
|
||||
// (r,g,b,a) with a = 255 (opaque)
|
||||
unsigned long lcol = (static_cast<unsigned long> (col.red()) << 24)
|
||||
| (static_cast<unsigned long> (col.green()) << 16)
|
||||
| (static_cast<unsigned long> (col.blue()) << 8) | 255;
|
||||
unsigned int icol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8) | 255;
|
||||
unsigned long lcol = static_cast<unsigned long>(icol);
|
||||
getWindowParameter()->SetUnsigned( entryName(), lcol );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user