Cast to unsigned char before calling toupper() (#648)

This commit is contained in:
Davis Vaughan
2021-02-24 12:49:46 -05:00
committed by GitHub
parent bf79dd5a81
commit 1c285d6545

View File

@@ -4779,7 +4779,7 @@ scan_keyword(std::basic_istream<CharT, Traits>& is, FwdIter kb, FwdIter ke)
is.setstate(std::ios::eofbit);
break;
}
auto c = static_cast<char>(toupper(ic));
auto c = static_cast<char>(toupper(static_cast<unsigned char>(ic)));
bool consume = false;
// For each keyword which might match, see if the indx character is c
// If a match if found, consume c
@@ -4792,7 +4792,7 @@ scan_keyword(std::basic_istream<CharT, Traits>& is, FwdIter kb, FwdIter ke)
{
if (*st == might_match)
{
if (c == static_cast<char>(toupper((*ky)[indx])))
if (c == static_cast<char>(toupper(static_cast<unsigned char>((*ky)[indx]))))
{
consume = true;
if (ky->size() == indx+1)