Conversation
Yeah, it's a bit ugly but I had to do that since Maybe the check could be done on the C++ side but ngl my C(++) is a bit rusty.
This could've be done as well but I opted in for a seperate method because I wanted to do as much as possible on the C++ side and other OpenAL bindings seem to do something similar. |
| while (*result != '\0') { | ||
|
|
||
| int length = strlen (result) + 1; | ||
| char* _result = (char*)malloc (length); |
There was a problem hiding this comment.
Don't we need a free() call to go with this?
There was a problem hiding this comment.
Don't we need a
free()call to go with this?
Maybe hl_alloc_bytes would be safer instead of malloc, since we can't call free() immediately?
There was a problem hiding this comment.
I've added a free() call. I've tested it a bit and it seems to work fine, but I will say again that my C(++) is a bit rusty so please do tell if I've overlooked something!!
I will also note that there's other malloc() calls in the OpenAL bindings that do not have a corresponding free() call. Perhaps this should also be handled in a seperate issue?
lime/project/src/media/openal/OpenALBindings.cpp
Lines 2209 to 2217 in 36d7953
lime/project/src/media/openal/OpenALBindings.cpp
Lines 3389 to 3398 in 36d7953
|
oh, i didnt notice youve made a pull request about this too until no |


Fixes #1986
There are certain OpenAL parameters, meant to be passed into
ALC.getString(), that return a list of strings. For example,ALC_ALL_DEVICES_SPECIFIERto get the names of available playback audio devices orALC_CAPTURE_DEVICE_SPECIFIERto get the names of available capture devices.ALC.getString()assumes that the result will always be a standard C string with a single NULL character at the end, but this is not the case when passing the params mentioned above:This PR introduces the
ALC.getStringList(device, param)method which handles these lists properly and returns them as anArray<String>. If list handling is unnecessary for the param provided, the result will simply be[ALC.getString(device, param)]