Replace c-style casts & fix implicit conversion warnings. SFML/SFML#2297

This commit is contained in:
zakinadhif 2022-12-14 14:53:45 +07:00 committed by Chris Thrasher
parent ed6d944810
commit 253a4abad4

View File

@ -412,7 +412,7 @@ namespace
event.key.shift = shiftDown();
event.key.system = systemDown();
keyMap[kb] = inputEvent.value;
keyMap[static_cast<std::size_t>(kb)] = inputEvent.value;
if (special && inputEvent.value)
doDeferredText = special;
@ -493,7 +493,7 @@ namespace
//
// We only clear the ICANON flag for the time of reading
newTerminalConfig.c_lflag &= ~(tcflag_t)ICANON;
newTerminalConfig.c_lflag &= ~static_cast<tcflag_t>(ICANON);
tcsetattr(STDIN_FILENO, TCSANOW, &newTerminalConfig);
timeval timeout;
@ -564,7 +564,7 @@ bool InputImpl::isKeyPressed(Keyboard::Key key)
return false;
update();
return keyMap[key];
return keyMap[static_cast<std::size_t>(key)];
}
@ -692,8 +692,8 @@ void InputImpl::setTerminalConfig()
tcgetattr(STDIN_FILENO, &newTerminalConfig); // get current terminal config
oldTerminalConfig = newTerminalConfig; // create a backup
newTerminalConfig.c_lflag &= ~(tcflag_t)ECHO; // disable console feedback
newTerminalConfig.c_lflag &= ~(tcflag_t)ISIG; // disable signals
newTerminalConfig.c_lflag &= ~static_cast<tcflag_t>(ECHO); // disable console feedback
newTerminalConfig.c_lflag &= ~static_cast<tcflag_t>(ISIG); // disable signals
newTerminalConfig.c_lflag |= ICANON; // disable noncanonical mode
newTerminalConfig.c_iflag |= IGNCR; // ignore carriage return
tcsetattr(STDIN_FILENO, TCSANOW, &newTerminalConfig); // set our new config