mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 11:28:15 +00:00
Fix undefined behavior in SDL_windowsmouse.c
This fix prevents C undefined behavior from being invoked on Windows if the user's configured cursor speed is below 6.
This commit is contained in:

committed by
Sam Lantinga

parent
1c7cc60286
commit
c21bc48a70
@@ -710,7 +710,7 @@ void WIN_UpdateMouseSystemScale(void)
|
||||
int v = 10;
|
||||
if (SystemParametersInfo(SPI_GETMOUSESPEED, 0, &v, 0)) {
|
||||
v = SDL_max(1, SDL_min(v, 20));
|
||||
data->dpiscale = SDL_max(SDL_max(v, (v - 2) << 2), (v - 6) << 3);
|
||||
data->dpiscale = SDL_max(SDL_max(v, (v - 2) * 4), (v - 6) * 8);
|
||||
}
|
||||
|
||||
int params[3];
|
||||
|
Reference in New Issue
Block a user