Fixed Visual Studio warning 4245

This commit is contained in:
Sam Lantinga 2023-03-30 14:02:06 -07:00
parent f341c06552
commit 85ee1498a5
6 changed files with 7 additions and 7 deletions

View file

@ -1380,14 +1380,14 @@ static SDL_JoystickGUID HIDAPI_JoystickGetDeviceGUID(int device_index)
static SDL_JoystickID HIDAPI_JoystickGetDeviceInstanceID(int device_index) static SDL_JoystickID HIDAPI_JoystickGetDeviceInstanceID(int device_index)
{ {
SDL_JoystickID joystickID = -1; SDL_JoystickID joystickID = 0;
HIDAPI_GetDeviceByIndex(device_index, &joystickID); HIDAPI_GetDeviceByIndex(device_index, &joystickID);
return joystickID; return joystickID;
} }
static int HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index) static int HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
{ {
SDL_JoystickID joystickID = -1; SDL_JoystickID joystickID = 0;
SDL_HIDAPI_Device *device = HIDAPI_GetDeviceByIndex(device_index, &joystickID); SDL_HIDAPI_Device *device = HIDAPI_GetDeviceByIndex(device_index, &joystickID);
struct joystick_hwdata *hwdata; struct joystick_hwdata *hwdata;

View file

@ -396,7 +396,7 @@ static SDL_JoystickID VIRTUAL_JoystickGetDeviceInstanceID(int device_index)
{ {
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
if (hwdata == NULL) { if (hwdata == NULL) {
return -1; return 0;
} }
return hwdata->instance_id; return hwdata->instance_id;
} }

View file

@ -141,7 +141,7 @@ static int SDLCALL SDL_TimerThread(void *_data)
} }
/* Initial delay if there are no timers */ /* Initial delay if there are no timers */
delay = SDL_MUTEX_MAXWAIT; delay = (Uint64)SDL_MUTEX_MAXWAIT;
tick = SDL_GetTicksNS(); tick = SDL_GetTicksNS();

View file

@ -796,7 +796,7 @@ Uint8 SDL_FindColor(SDL_Palette *pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
int i; int i;
Uint8 pixel = 0; Uint8 pixel = 0;
smallest = ~0; smallest = ~0U;
for (i = 0; i < pal->ncolors; ++i) { for (i = 0; i < pal->ncolors; ++i) {
rd = pal->colors[i].r - r; rd = pal->colors[i].r - r;
gd = pal->colors[i].g - g; gd = pal->colors[i].g - g;

View file

@ -587,7 +587,7 @@ static BOOL WIN_ConvertUTF32toUTF8(UINT32 codepoint, char *text)
static BOOL WIN_ConvertUTF16toUTF8(UINT32 high_surrogate, UINT32 low_surrogate, char *text) static BOOL WIN_ConvertUTF16toUTF8(UINT32 high_surrogate, UINT32 low_surrogate, char *text)
{ {
const UINT32 SURROGATE_OFFSET = 0x10000 - (0xD800 << 10) - 0xDC00; const UINT32 SURROGATE_OFFSET = 0x10000U - (0xD800 << 10) - 0xDC00;
const UINT32 codepoint = (high_surrogate << 10) + low_surrogate + SURROGATE_OFFSET; const UINT32 codepoint = (high_surrogate << 10) + low_surrogate + SURROGATE_OFFSET;
return WIN_ConvertUTF32toUTF8(codepoint, text); return WIN_ConvertUTF32toUTF8(codepoint, text);
} }

View file

@ -684,7 +684,7 @@ SDL_SystemTheme WIN_GetSystemTheme(void)
SDL_SystemTheme theme = SDL_SYSTEM_THEME_LIGHT; SDL_SystemTheme theme = SDL_SYSTEM_THEME_LIGHT;
HKEY hKey; HKEY hKey;
DWORD dwType = REG_DWORD; DWORD dwType = REG_DWORD;
DWORD value = ~0; DWORD value = ~0U;
DWORD length = sizeof(value); DWORD length = sizeof(value);
/* Technically this isn't the system theme, but it's the preference for applications */ /* Technically this isn't the system theme, but it's the preference for applications */