diff options
author | Chris Robinson <[email protected]> | 2023-05-04 09:16:59 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-04 09:27:19 -0700 |
commit | 6e0a0a2692a4303d6410c24bf83e09ca47ac6759 (patch) | |
tree | 906db65a3900d89b07a67d8b938ecc5977dcb9bb /al | |
parent | 3d2e586636f765eb2fccebb757305295d7b2c954 (diff) |
Make and use a bit_cast function
Instead of reinterpret_casting between incompatible types
Diffstat (limited to 'al')
-rw-r--r-- | al/buffer.cpp | 2 | ||||
-rw-r--r-- | al/state.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp index 4f0bcf8c..ad74a7f7 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -1463,7 +1463,7 @@ START_API_FUNC else switch(param) { case AL_BUFFER_CALLBACK_FUNCTION_SOFT: - *value = reinterpret_cast<void*>(albuf->mCallback); + *value = al::bit_cast<void*>(albuf->mCallback); break; case AL_BUFFER_CALLBACK_USER_PARAM_SOFT: *value = albuf->mUserData; diff --git a/al/state.cpp b/al/state.cpp index 77b104a4..fb3186c7 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -35,6 +35,7 @@ #include "AL/alext.h" #include "al/debug.h" +#include "albit.h" #include "alc/alu.h" #include "alc/context.h" #include "alc/inprogext.h" @@ -516,7 +517,7 @@ START_API_FUNC switch(pname) { case AL_EVENT_CALLBACK_FUNCTION_SOFT: - *values = reinterpret_cast<void*>(context->mEventCb); + *values = al::bit_cast<void*>(context->mEventCb); break; case AL_EVENT_CALLBACK_USER_PARAM_SOFT: @@ -524,7 +525,7 @@ START_API_FUNC break; case AL_DEBUG_CALLBACK_FUNCTION_EXT: - *values = reinterpret_cast<void*>(context->mDebugCb); + *values = al::bit_cast<void*>(context->mDebugCb); break; case AL_DEBUG_CALLBACK_USER_PARAM_EXT: |