input_common: Resolve C4267 warning on MSVC

This commit is contained in:
Morph 2022-05-12 02:49:52 -04:00
parent 1cc1c33a15
commit 4e73ff3978

View file

@ -335,7 +335,8 @@ std::shared_ptr<SDLJoystick> SDLState::GetSDLJoystickBySDLID(SDL_JoystickID sdl_
} }
// There is no SDLJoystick without a mapped SDL_Joystick // There is no SDLJoystick without a mapped SDL_Joystick
// Create a new SDLJoystick // Create a new SDLJoystick
auto joystick = std::make_shared<SDLJoystick>(guid, map_it->second.size(), sdl_joystick); auto joystick = std::make_shared<SDLJoystick>(guid, static_cast<int>(map_it->second.size()),
sdl_joystick);
return map_it->second.emplace_back(std::move(joystick)); return map_it->second.emplace_back(std::move(joystick));
} }
auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick); auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick);
@ -483,7 +484,8 @@ void SDLState::InitJoystick(int joystick_index) {
(*it)->SetSDLJoystick(sdl_joystick); (*it)->SetSDLJoystick(sdl_joystick);
return; return;
} }
auto joystick = std::make_shared<SDLJoystick>(guid, joystick_guid_list.size(), sdl_joystick); auto joystick = std::make_shared<SDLJoystick>(guid, static_cast<int>(joystick_guid_list.size()),
sdl_joystick);
joystick_guid_list.emplace_back(std::move(joystick)); joystick_guid_list.emplace_back(std::move(joystick));
} }
@ -519,8 +521,8 @@ void SDLState::InitGameController(int controller_index) {
(*it)->SetSDLGameController(sdl_controller); (*it)->SetSDLGameController(sdl_controller);
return; return;
} }
auto controller = auto controller = std::make_shared<SDLGameController>(
std::make_shared<SDLGameController>(guid, controller_guid_list.size(), sdl_controller); guid, static_cast<int>(controller_guid_list.size()), sdl_controller);
controller_guid_list.emplace_back(std::move(controller)); controller_guid_list.emplace_back(std::move(controller));
} }