veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.18k stars 219 forks source link

Use of platform-specific int type for JoyDeviceAddedEvent.Which #451

Closed seletskiy closed 4 years ago

seletskiy commented 4 years ago

Line in question:

https://github.com/veandco/go-sdl2/blob/0f0aff6510ff6b885d668509789fbf6120e47d8c/sdl/events.go#L564

I believe this should be declared as int32 instead of int, since it will be silently compiled as int64 on 64-bit systems.

In particular, joystick-input example from go-sdl2-examples fails with panic because of that.

veeableful commented 4 years ago

Hi @seletskiy, thank you for catching that. I have changed it to use sdl.JoystickID which is an int32 in the latest patch version!

seletskiy commented 4 years ago

@veeableful: nice one!