aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/pipewire.cpp
diff options
context:
space:
mode:
authorChris Robinson <chris.kcat@gmail.com>2023-05-04 09:16:59 -0700
committerChris Robinson <chris.kcat@gmail.com>2023-05-04 09:27:19 -0700
commit6e0a0a2692a4303d6410c24bf83e09ca47ac6759 (patch)
tree906db65a3900d89b07a67d8b938ecc5977dcb9bb /alc/backends/pipewire.cpp
parent3d2e586636f765eb2fccebb757305295d7b2c954 (diff)
Make and use a bit_cast function
Instead of reinterpret_casting between incompatible types
Diffstat (limited to 'alc/backends/pipewire.cpp')
-rw-r--r--alc/backends/pipewire.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp
index d3c8e77e..5b1596aa 100644
--- a/alc/backends/pipewire.cpp
+++ b/alc/backends/pipewire.cpp
@@ -37,6 +37,7 @@
#include <type_traits>
#include <utility>
+#include "albit.h"
#include "albyte.h"
#include "alc/alconfig.h"
#include "almalloc.h"
@@ -210,7 +211,7 @@ bool pwire_load()
}
#define LOAD_FUNC(f) do { \
- p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(pwire_handle, #f)); \
+ p##f = al::bit_cast<decltype(p##f)>(GetSymbol(pwire_handle, #f)); \
if(p##f == nullptr) missing_funcs += "\n" #f; \
} while(0);
PWIRE_FUNCS(LOAD_FUNC)
@@ -328,11 +329,11 @@ To as(From) noexcept = delete;
* - pw_metadata
*/
template<>
-pw_proxy* as(pw_registry *reg) noexcept { return reinterpret_cast<pw_proxy*>(reg); }
+pw_proxy* as(pw_registry *reg) noexcept { return al::bit_cast<pw_proxy*>(reg); }
template<>
-pw_proxy* as(pw_node *node) noexcept { return reinterpret_cast<pw_proxy*>(node); }
+pw_proxy* as(pw_node *node) noexcept { return al::bit_cast<pw_proxy*>(node); }
template<>
-pw_proxy* as(pw_metadata *mdata) noexcept { return reinterpret_cast<pw_proxy*>(mdata); }
+pw_proxy* as(pw_metadata *mdata) noexcept { return al::bit_cast<pw_proxy*>(mdata); }
struct PwContextDeleter {