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)
{
SDL_JoystickID joystickID = -1;
SDL_JoystickID joystickID = 0;
HIDAPI_GetDeviceByIndex(device_index, &joystickID);
return joystickID;
}
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);
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);
if (hwdata == NULL) {
return -1;
return 0;
}
return hwdata->instance_id;
}

View File

@ -141,7 +141,7 @@ static int SDLCALL SDL_TimerThread(void *_data)
}
/* Initial delay if there are no timers */
delay = SDL_MUTEX_MAXWAIT;
delay = (Uint64)SDL_MUTEX_MAXWAIT;
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;
Uint8 pixel = 0;
smallest = ~0;
smallest = ~0U;
for (i = 0; i < pal->ncolors; ++i) {
rd = pal->colors[i].r - r;
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)
{
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;
return WIN_ConvertUTF32toUTF8(codepoint, text);
}

View File

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