From ba87b96ceabf68ab8eb87c8ceea7c9dbf9fbc706 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 8 Mar 2023 12:36:44 -0800
Subject: [PATCH] Fixed signed/unsigned warnings
Fixes https://github.com/libsdl-org/SDL/issues/7424
---
src/hidapi/linux/hid.c | 2 +-
src/joystick/hidapi/SDL_hidapi_xbox360.c | 4 ++--
src/joystick/hidapi/SDL_hidapi_xbox360w.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/hidapi/linux/hid.c b/src/hidapi/linux/hid.c
index d1edb1606ca2..ee8ccef22a27 100644
--- a/src/hidapi/linux/hid.c
+++ b/src/hidapi/linux/hid.c
@@ -421,7 +421,7 @@ static int get_device_string(hid_device *dev, enum device_string_id key, wchar_t
const char *str;
const char *key_str = NULL;
- if (key >= 0 && key < DEVICE_STRING_COUNT) {
+ if ((int)key >= 0 && (int)key < DEVICE_STRING_COUNT) {
key_str = device_string_names[key];
} else {
ret = -1;
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360.c b/src/joystick/hidapi/SDL_hidapi_xbox360.c
index a8a29221393f..3c5729603c0e 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c
@@ -113,7 +113,7 @@ static SDL_bool SetSlotLED(SDL_hid_device *dev, Uint8 slot, SDL_bool on)
static void UpdateSlotLED(SDL_DriverXbox360_Context *ctx)
{
- if (ctx->player_lights && ctx->player_lights >= 0) {
+ if (ctx->player_lights) {
SetSlotLED(ctx->device->dev, (ctx->player_index % 4), SDL_TRUE);
} else {
SetSlotLED(ctx->device->dev, 0, SDL_FALSE);
@@ -307,7 +307,7 @@ static void HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, SDL_D
}
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, axis);
- SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state)));
+ SDL_memcpy(ctx->last_state, data, SDL_min((size_t)size, sizeof(ctx->last_state)));
}
static SDL_bool HIDAPI_DriverXbox360_UpdateDevice(SDL_HIDAPI_Device *device)
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
index 9a3e5886786f..30db93a2c869 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360w.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
@@ -87,7 +87,7 @@ static SDL_bool SetSlotLED(SDL_hid_device *dev, Uint8 slot, SDL_bool on)
static void UpdateSlotLED(SDL_DriverXbox360W_Context *ctx)
{
- if (ctx->player_lights && ctx->player_lights >= 0) {
+ if (ctx->player_lights) {
SetSlotLED(ctx->device->dev, (ctx->player_index % 4), SDL_TRUE);
} else {
SetSlotLED(ctx->device->dev, 0, SDL_FALSE);