mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-07 06:03:21 -04:00
C26472, no static_cast for arithmetic conversions. narrow or narrow_cast
This commit is contained in:
@@ -87,10 +87,10 @@ void TextAttribute::SetBackground(const COLORREF rgbBackground)
|
||||
|
||||
void TextAttribute::SetFromLegacy(const WORD wLegacy) noexcept
|
||||
{
|
||||
_wAttrLegacy = static_cast<WORD>(wLegacy & META_ATTRS);
|
||||
_wAttrLegacy = gsl::narrow_cast<WORD>(wLegacy & META_ATTRS);
|
||||
WI_ClearAllFlags(_wAttrLegacy, COMMON_LVB_SBCSDBCS);
|
||||
const BYTE fgIndex = static_cast<BYTE>(wLegacy & FG_ATTRS);
|
||||
const BYTE bgIndex = static_cast<BYTE>(wLegacy & BG_ATTRS) >> 4;
|
||||
const BYTE fgIndex = gsl::narrow_cast<BYTE>(wLegacy & FG_ATTRS);
|
||||
const BYTE bgIndex = gsl::narrow_cast<BYTE>(wLegacy & BG_ATTRS) >> 4;
|
||||
_foreground = TextColor(fgIndex);
|
||||
_background = TextColor(bgIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user