C26472, no static_cast for arithmetic conversions. narrow or narrow_cast

This commit is contained in:
Michael Niksa
2019-08-29 13:19:01 -07:00
parent a381f6a042
commit 8ea7401dc9
11 changed files with 45 additions and 45 deletions

View File

@@ -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);
}