yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

input_common/sdl/sdl_impl: Resolve two sign conversion warnings

Silences the final two warnings in SDL code.
This commit is contained in:
Lioncash 2019-06-03 16:04:56 -04:00
parent cf0d01a5d7
commit 7ea07c6063
1 changed files with 16 additions and 10 deletions

View File

@ -161,7 +161,8 @@ std::shared_ptr<SDLJoystick> SDLState::GetSDLJoystickBySDLID(SDL_JoystickID sdl_
std::lock_guard lock{joystick_map_mutex}; std::lock_guard lock{joystick_map_mutex};
auto map_it = joystick_map.find(guid); auto map_it = joystick_map.find(guid);
if (map_it != joystick_map.end()) { if (map_it != joystick_map.end()) {
auto vec_it = std::find_if(map_it->second.begin(), map_it->second.end(), const auto vec_it =
std::find_if(map_it->second.begin(), map_it->second.end(),
[&sdl_joystick](const std::shared_ptr<SDLJoystick>& joystick) { [&sdl_joystick](const std::shared_ptr<SDLJoystick>& joystick) {
return sdl_joystick == joystick->GetSDLJoystick(); return sdl_joystick == joystick->GetSDLJoystick();
}); });
@ -170,8 +171,9 @@ std::shared_ptr<SDLJoystick> SDLState::GetSDLJoystickBySDLID(SDL_JoystickID sdl_
// SDLJoystick. return the SDLJoystick // SDLJoystick. return the SDLJoystick
return *vec_it; return *vec_it;
} }
// Search for a SDLJoystick without a mapped SDL_Joystick... // Search for a SDLJoystick without a mapped SDL_Joystick...
auto nullptr_it = std::find_if(map_it->second.begin(), map_it->second.end(), const auto nullptr_it = std::find_if(map_it->second.begin(), map_it->second.end(),
[](const std::shared_ptr<SDLJoystick>& joystick) { [](const std::shared_ptr<SDLJoystick>& joystick) {
return !joystick->GetSDLJoystick(); return !joystick->GetSDLJoystick();
}); });
@ -180,11 +182,14 @@ std::shared_ptr<SDLJoystick> SDLState::GetSDLJoystickBySDLID(SDL_JoystickID sdl_
(*nullptr_it)->SetSDLJoystick(sdl_joystick); (*nullptr_it)->SetSDLJoystick(sdl_joystick);
return *nullptr_it; return *nullptr_it;
} }
// 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); const int port = static_cast<int>(map_it->second.size());
auto joystick = std::make_shared<SDLJoystick>(guid, port, 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);
return joystick_map[guid].emplace_back(std::move(joystick)); return joystick_map[guid].emplace_back(std::move(joystick));
} }
@ -211,7 +216,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); const int port = static_cast<int>(joystick_guid_list.size());
auto joystick = std::make_shared<SDLJoystick>(guid, port, sdl_joystick);
joystick_guid_list.emplace_back(std::move(joystick)); joystick_guid_list.emplace_back(std::move(joystick));
} }