fix: implied return and NULL cast to uint64_t #171
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The wrapper functions in
cute_draw.h
are meant to return bool type, however the return values of internalcf_*
functions which are called aren't stored or returned, thus making these functions return nothing. Easily fixed by calling the internal functions within the wrapper and returning the returned values.In
cute_audio.cpp
, a NULL was returned previously. Due toCF_Audio
having just one field in the struct for the data, that would mean the NULL would be cast to uint64_t. This means that comparing the return value fromcf_audio_load_*
functions to NULL would not yield any actual results in some scenarios, as the value would be cast touint64_t
, resulting in undefined behavior. Solution is simple, just return an emptyCF_Audio
struct. Then, if needed, the return value can simply be compared to 0, which would imply that either theCF_Audio
wasn't yet populated, OR there was an error trying to load audio. (NOTE: Asserts can also be used here to indicate what is PRECISELY the case.)