Fixed warnings

This commit is contained in:
Sam Lantinga
2023-01-03 15:59:35 -08:00
parent 95e5417d2e
commit 32c077216c
5 changed files with 9 additions and 9 deletions

View File

@@ -508,7 +508,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
mouse->x = x;
mouse->y = y;
mouse->has_position = SDL_TRUE;
} else if (!xrel && !yrel) { /* Drop events that don't change state */
} else if (xrel == 0.0f && yrel == 0.0f) { /* Drop events that don't change state */
#ifdef DEBUG_MOUSE
SDL_Log("Mouse event didn't change state - dropped!\n");
#endif

View File

@@ -375,7 +375,7 @@ stdio_read(SDL_RWops *context, void *ptr, Sint64 size)
{
size_t nread;
nread = fread(ptr, 1, size, (FILE *)context->hidden.stdio.fp);
nread = fread(ptr, 1, (size_t)size, (FILE *)context->hidden.stdio.fp);
if (nread == 0 && ferror((FILE *)context->hidden.stdio.fp)) {
return SDL_Error(SDL_EFREAD);
}
@@ -387,7 +387,7 @@ stdio_write(SDL_RWops *context, const void *ptr, Sint64 size)
{
size_t nwrote;
nwrote = fwrite(ptr, 1, size, (FILE *)context->hidden.stdio.fp);
nwrote = fwrite(ptr, 1, (size_t)size, (FILE *)context->hidden.stdio.fp);
if (nwrote == 0 && ferror((FILE *)context->hidden.stdio.fp)) {
return SDL_Error(SDL_EFWRITE);
}

View File

@@ -700,7 +700,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
}
} else if (size == 64) {
if (ctx->last_state[46] != data[46]) {
SDL_PrivateJoystickButton(joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[46] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(joystick, SDL_GAMEPAD_BUTTON_MISC1, (data[46] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
}
}
}

View File

@@ -158,8 +158,8 @@ void SDL_DelayNS(Uint64 ns)
/* Set the timeout interval */
#if HAVE_NANOSLEEP
remaining.tv_sec = (ns / SDL_NS_PER_SECOND);
remaining.tv_nsec = (ns % SDL_NS_PER_SECOND);
remaining.tv_sec = (time_t)(ns / SDL_NS_PER_SECOND);
remaining.tv_nsec = (long)(ns % SDL_NS_PER_SECOND);
#else
then = SDL_GetTicksNS();
#endif

View File

@@ -922,7 +922,7 @@ static SDL_DisplayMode *SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *di
}
/* Default to the desktop refresh rate */
if (mode->refresh_rate) {
if (mode->refresh_rate > 0.0f) {
target_refresh_rate = mode->refresh_rate;
} else {
target_refresh_rate = display->desktop_mode.refresh_rate;
@@ -981,7 +981,7 @@ static SDL_DisplayMode *SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *di
closest->w = mode->w;
closest->h = mode->h;
}
if (match->refresh_rate) {
if (match->refresh_rate > 0.0f) {
closest->refresh_rate = match->refresh_rate;
} else {
closest->refresh_rate = mode->refresh_rate;
@@ -1043,7 +1043,7 @@ static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_Dis
if (!display_mode.h) {
display_mode.h = display->current_mode.h;
}
if (!display_mode.refresh_rate) {
if (display_mode.refresh_rate == 0.0f) {
display_mode.refresh_rate = display->current_mode.refresh_rate;
}