Fix signed-unsigned comparisons and mark warning as error (part 2).

This commit is contained in:
Nekotekina 2020-02-19 20:03:59 +03:00
parent 771eff273b
commit 92e3eaf3ff
68 changed files with 194 additions and 202 deletions

View file

@ -163,7 +163,7 @@ void ds3_pad_handler::SetPadData(const std::string& padId, u32 largeMotor, u32 s
device->small_motor = smallMotor;
int index = 0;
for (int i = 0; i < MAX_GAMEPADS; i++)
for (uint i = 0; i < MAX_GAMEPADS; i++)
{
if (g_cfg_input.player[i]->handler == pad_handler::ds3)
{
@ -222,7 +222,7 @@ std::shared_ptr<ds3_pad_handler::ds3_device> ds3_pad_handler::get_ds3_device(con
return nullptr;
int pad_number = std::stoi(padId.substr(pos + 9));
if (pad_number > 0 && pad_number <= controllers.size())
if (pad_number > 0 && pad_number + 0u <= controllers.size())
return controllers[static_cast<size_t>(pad_number) - 1];
return nullptr;

View file

@ -192,7 +192,7 @@ void ds4_pad_handler::SetPadData(const std::string& padId, u32 largeMotor, u32 s
device->smallVibrate = smallMotor;
int index = 0;
for (int i = 0; i < MAX_GAMEPADS; i++)
for (uint i = 0; i < MAX_GAMEPADS; i++)
{
if (g_cfg_input.player[i]->handler == pad_handler::ds4)
{

View file

@ -738,7 +738,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
// Translate any corresponding keycodes to our normal DS3 buttons and triggers
for (int i = 0; i < static_cast<int>(pad->m_buttons.size()); i++)
{
if (pad->m_buttons[i].m_keyCode != button_code)
if (pad->m_buttons[i].m_keyCode != button_code + 0u)
continue;
// Be careful to handle mapped axis specially
@ -773,7 +773,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
bool pressed_max = false;
// m_keyCodeMin is the mapped key for left or down
if (pad->m_sticks[idx].m_keyCodeMin == button_code)
if (pad->m_sticks[idx].m_keyCodeMin == button_code + 0u)
{
bool is_direction_min = false;
@ -799,7 +799,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
}
// m_keyCodeMax is the mapped key for right or up
if (pad->m_sticks[idx].m_keyCodeMax == button_code)
if (pad->m_sticks[idx].m_keyCodeMax == button_code + 0u)
{
bool is_direction_max = false;

View file

@ -633,7 +633,7 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
void keyboard_pad_handler::ThreadProc()
{
for (int i = 0; i < bindings.size(); i++)
for (uint i = 0; i < bindings.size(); i++)
{
if (last_connection_status[i] == false)
{