lispgames / cl-sdl2

Common Lisp bindings for SDL2 using C2FFI.
MIT License
304 stars 82 forks source link

File stream not being closed after reading game controller mapping #132

Closed ellisvelo closed 3 years ago

ellisvelo commented 3 years ago

Hello,

I noticed what appears to be a minor issue that the stream is not closed. SDL-GAME-CONTROLLER-ADD-MAPPINGS-FROM-RW has a 0 argument to prevent the closing of the stream. This is different from the #define in SDL_gamecontroller.h which uses a 1 to close the stream.

gamecontroller.lisp: (defun game-controller-add-mappings-from-file (file-name) (sdl-game-controller-add-mappings-from-rw (sdl-rw-from-file file-name "rb") 0))

SDL_gamecontroller.h: #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)

ellisvelo commented 3 years ago

The link below has a patch that changes the 0 to a 1.

https://gist.githubusercontent.com/ellisvelo/76b96cece57ed46b0dcefbcf8695e2e4/raw/cd53f637f169422aab937e8864bb77bd8bfcef72/close-filestream.patch

mfiano commented 3 years ago

Sorry for the late reply, I must have missed the first message.

Please submit a proper pull request to this repository, and will merge it after testing. Thanks!

ellisvelo commented 3 years ago

Ok, will do. Thanks.