diff options
author | Chris Robinson <[email protected]> | 2024-01-03 14:58:07 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2024-01-03 14:58:07 -0800 |
commit | 18349e1da2c79d0f41c8c4f12ccd065f91618a6f (patch) | |
tree | 43124b48b1542f9049d20a01f0c625a954b96510 /alc/backends/jack.cpp | |
parent | e90075031dfeec7ff03d5d1c5e319e7472312f46 (diff) |
Avoid using bit_cast for pointer types
Diffstat (limited to 'alc/backends/jack.cpp')
-rw-r--r-- | alc/backends/jack.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index 922873b8..1e5c17ad 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -109,13 +109,9 @@ jack_options_t ClientOptions = JackNullOption; bool jack_load() { - bool error{false}; - #ifdef HAVE_DYNLOAD if(!jack_handle) { - std::string missing_funcs; - #ifdef _WIN32 #define JACKLIB "libjack.dll" #else @@ -128,31 +124,29 @@ bool jack_load() return false; } - error = false; + std::string missing_funcs; #define LOAD_FUNC(f) do { \ - p##f = al::bit_cast<decltype(p##f)>(GetSymbol(jack_handle, #f)); \ - if(p##f == nullptr) { \ - error = true; \ - missing_funcs += "\n" #f; \ - } \ + p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(jack_handle, #f)); \ + if(p##f == nullptr) missing_funcs += "\n" #f; \ } while(0) JACK_FUNCS(LOAD_FUNC); #undef LOAD_FUNC /* Optional symbols. These don't exist in all versions of JACK. */ -#define LOAD_SYM(f) p##f = al::bit_cast<decltype(p##f)>(GetSymbol(jack_handle, #f)) +#define LOAD_SYM(f) p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(jack_handle, #f)) LOAD_SYM(jack_error_callback); #undef LOAD_SYM - if(error) + if(!missing_funcs.empty()) { WARN("Missing expected functions:%s\n", missing_funcs.c_str()); CloseLib(jack_handle); jack_handle = nullptr; + return false; } } #endif - return !error; + return true; } |