libsdl-org/sdl2-compat

procs returning (and possibly accepting) SDL_XxxID types

sezero opened this issue · 2 comments

Some procs returning (and possibly accepting) SDL_XxxxID type seem to
have wrong signatures, e.g. SDL_SensorID instead of SDL2_SensorID,
i.e. signed vs unsigned. Do we want to fix them? (Noticed by a warning
from g++ 3.4)

sdl2_compat.c: In function `SDL2_JoystickID SDL_JoystickGetDeviceInstanceID_REAL(int)':
sdl2_compat.c:3712: warning: converting of negative value `-0x000000001' to `unsigned int'
sdl2_compat.c: In function `SDL2_SensorID SDL_SensorGetDeviceInstanceID_REAL(int)':
sdl2_compat.c:3828: warning: converting of negative value `-0x000000001' to `unsigned int'

Yeah, this looks wrong, and I think that's a good warning. In SDL3, 0 is an invalid instance ID, where in SDL2, -1 is an invalid instance ID.

Pushed 5f8ae97 and aefeebc - please make sure that they are OK and nothing is broken.