aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--al/buffer.cpp2
-rw-r--r--al/state.cpp4
-rw-r--r--alc/alc.cpp2
-rw-r--r--alc/backends/alsa.cpp18
-rw-r--r--alc/backends/dsound.cpp2
-rw-r--r--alc/backends/jack.cpp20
-rw-r--r--alc/backends/pipewire.cpp8
-rw-r--r--alc/backends/portaudio.cpp9
-rw-r--r--alc/backends/pulseaudio.cpp13
-rw-r--r--common/dynload.cpp7
-rw-r--r--core/dbus_wrap.cpp18
11 files changed, 42 insertions, 61 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index 2aafbf2d..b7ed5b32 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -1373,7 +1373,7 @@ FORCE_ALIGN void AL_APIENTRY alGetBufferPtrDirectSOFT(ALCcontext *context, ALuin
else switch(param)
{
case AL_BUFFER_CALLBACK_FUNCTION_SOFT:
- *value = al::bit_cast<void*>(albuf->mCallback);
+ *value = reinterpret_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 c1e3d593..3ef87fbb 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -463,7 +463,7 @@ FORCE_ALIGN void AL_APIENTRY alGetPointervDirectSOFT(ALCcontext *context, ALenum
switch(pname)
{
case AL_EVENT_CALLBACK_FUNCTION_SOFT:
- *values = al::bit_cast<void*>(context->mEventCb);
+ *values = reinterpret_cast<void*>(context->mEventCb);
break;
case AL_EVENT_CALLBACK_USER_PARAM_SOFT:
@@ -471,7 +471,7 @@ FORCE_ALIGN void AL_APIENTRY alGetPointervDirectSOFT(ALCcontext *context, ALenum
break;
case AL_DEBUG_CALLBACK_FUNCTION_EXT:
- *values = al::bit_cast<void*>(context->mDebugCb);
+ *values = reinterpret_cast<void*>(context->mDebugCb);
break;
case AL_DEBUG_CALLBACK_USER_PARAM_EXT:
diff --git a/alc/alc.cpp b/alc/alc.cpp
index e5f2c545..b63317e7 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -174,7 +174,7 @@ BOOL APIENTRY DllMain(HINSTANCE module, DWORD reason, LPVOID /*reserved*/)
case DLL_PROCESS_ATTACH:
/* Pin the DLL so we won't get unloaded until the process terminates */
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_PIN | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
- al::bit_cast<WCHAR*>(module), &module);
+ reinterpret_cast<WCHAR*>(module), &module);
break;
}
return TRUE;
diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp
index d7dd16c0..4bda5b02 100644
--- a/alc/backends/alsa.cpp
+++ b/alc/backends/alsa.cpp
@@ -1196,13 +1196,9 @@ ClockLatency AlsaCapture::getClockLatency()
bool AlsaBackendFactory::init()
{
- bool error{false};
-
#ifdef HAVE_DYNLOAD
if(!alsa_handle)
{
- std::string missing_funcs;
-
alsa_handle = LoadLib("libasound.so.2");
if(!alsa_handle)
{
@@ -1210,27 +1206,25 @@ bool AlsaBackendFactory::init()
return false;
}
- error = false;
+ std::string missing_funcs;
#define LOAD_FUNC(f) do { \
- p##f = al::bit_cast<decltype(p##f)>(GetSymbol(alsa_handle, #f)); \
- if(p##f == nullptr) { \
- error = true; \
- missing_funcs += "\n" #f; \
- } \
+ p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(alsa_handle, #f)); \
+ if(p##f == nullptr) missing_funcs += "\n" #f; \
} while(0)
ALSA_FUNCS(LOAD_FUNC);
#undef LOAD_FUNC
- if(error)
+ if(!missing_funcs.empty())
{
WARN("Missing expected functions:%s\n", missing_funcs.c_str());
CloseLib(alsa_handle);
alsa_handle = nullptr;
+ return false;
}
}
#endif
- return !error;
+ return true;
}
bool AlsaBackendFactory::querySupport(BackendType type)
diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp
index 59a59a9f..e51c7ab5 100644
--- a/alc/backends/dsound.cpp
+++ b/alc/backends/dsound.cpp
@@ -774,7 +774,7 @@ bool DSoundBackendFactory::init()
}
#define LOAD_FUNC(f) do { \
- p##f = al::bit_cast<decltype(p##f)>(GetSymbol(ds_handle, #f)); \
+ p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(ds_handle, #f)); \
if(!p##f) \
{ \
CloseLib(ds_handle); \
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;
}
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp
index c31f943e..55bcf6f4 100644
--- a/alc/backends/pipewire.cpp
+++ b/alc/backends/pipewire.cpp
@@ -256,7 +256,7 @@ bool pwire_load()
}
#define LOAD_FUNC(f) do { \
- p##f = al::bit_cast<decltype(p##f)>(GetSymbol(pwire_handle, #f)); \
+ p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(pwire_handle, #f)); \
if(p##f == nullptr) missing_funcs += "\n" #f; \
} while(0);
PWIRE_FUNCS(LOAD_FUNC)
@@ -374,11 +374,11 @@ To as(From) noexcept = delete;
* - pw_metadata
*/
template<>
-pw_proxy* as(pw_registry *reg) noexcept { return al::bit_cast<pw_proxy*>(reg); }
+pw_proxy* as(pw_registry *reg) noexcept { return reinterpret_cast<pw_proxy*>(reg); }
template<>
-pw_proxy* as(pw_node *node) noexcept { return al::bit_cast<pw_proxy*>(node); }
+pw_proxy* as(pw_node *node) noexcept { return reinterpret_cast<pw_proxy*>(node); }
template<>
-pw_proxy* as(pw_metadata *mdata) noexcept { return al::bit_cast<pw_proxy*>(mdata); }
+pw_proxy* as(pw_metadata *mdata) noexcept { return reinterpret_cast<pw_proxy*>(mdata); }
struct PwContextDeleter {
diff --git a/alc/backends/portaudio.cpp b/alc/backends/portaudio.cpp
index a8bd00fd..7c61e134 100644
--- a/alc/backends/portaudio.cpp
+++ b/alc/backends/portaudio.cpp
@@ -349,8 +349,6 @@ void PortCapture::captureSamples(std::byte *buffer, uint samples)
bool PortBackendFactory::init()
{
- PaError err;
-
#ifdef HAVE_DYNLOAD
if(!pa_handle)
{
@@ -369,7 +367,7 @@ bool PortBackendFactory::init()
return false;
#define LOAD_FUNC(f) do { \
- p##f = al::bit_cast<decltype(p##f)>(GetSymbol(pa_handle, #f)); \
+ p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(pa_handle, #f)); \
if(p##f == nullptr) \
{ \
CloseLib(pa_handle); \
@@ -389,7 +387,7 @@ bool PortBackendFactory::init()
LOAD_FUNC(Pa_GetStreamInfo);
#undef LOAD_FUNC
- err = Pa_Initialize();
+ const PaError err{Pa_Initialize()};
if(err != paNoError)
{
ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
@@ -399,7 +397,8 @@ bool PortBackendFactory::init()
}
}
#else
- if((err=Pa_Initialize()) != paNoError)
+ const PaError err{Pa_Initialize()};
+ if(err != paNoError)
{
ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
return false;
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 77d45466..e976fc27 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -1389,9 +1389,6 @@ bool PulseBackendFactory::init()
#ifdef HAVE_DYNLOAD
if(!pulse_handle)
{
- bool ret{true};
- std::string missing_funcs;
-
#ifdef _WIN32
#define PALIB "libpulse-0.dll"
#elif defined(__APPLE__) && defined(__MACH__)
@@ -1406,17 +1403,15 @@ bool PulseBackendFactory::init()
return false;
}
+ std::string missing_funcs;
#define LOAD_FUNC(x) do { \
- p##x = al::bit_cast<decltype(p##x)>(GetSymbol(pulse_handle, #x)); \
- if(!(p##x)) { \
- ret = false; \
- missing_funcs += "\n" #x; \
- } \
+ p##x = reinterpret_cast<decltype(p##x)>(GetSymbol(pulse_handle, #x)); \
+ if(!(p##x)) missing_funcs += "\n" #x; \
} while(0)
PULSE_FUNCS(LOAD_FUNC)
#undef LOAD_FUNC
- if(!ret)
+ if(!missing_funcs.empty())
{
WARN("Missing expected functions:%s\n", missing_funcs.c_str());
CloseLib(pulse_handle);
diff --git a/common/dynload.cpp b/common/dynload.cpp
index 86c36e00..333a9435 100644
--- a/common/dynload.cpp
+++ b/common/dynload.cpp
@@ -3,13 +3,12 @@
#include "dynload.h"
-#include "albit.h"
-#include "strutils.h"
-
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include "strutils.h"
+
void *LoadLib(const char *name)
{
std::wstring wname{utf8_to_wstr(name)};
@@ -18,7 +17,7 @@ void *LoadLib(const char *name)
void CloseLib(void *handle)
{ FreeLibrary(static_cast<HMODULE>(handle)); }
void *GetSymbol(void *handle, const char *name)
-{ return al::bit_cast<void*>(GetProcAddress(static_cast<HMODULE>(handle), name)); }
+{ return reinterpret_cast<void*>(GetProcAddress(static_cast<HMODULE>(handle), name)); }
#elif defined(HAVE_DLFCN_H)
diff --git a/core/dbus_wrap.cpp b/core/dbus_wrap.cpp
index 08020c9b..05d9fc06 100644
--- a/core/dbus_wrap.cpp
+++ b/core/dbus_wrap.cpp
@@ -8,7 +8,6 @@
#include <mutex>
#include <type_traits>
-#include "albit.h"
#include "logging.h"
@@ -16,8 +15,15 @@ void PrepareDBus()
{
const char *libname{"libdbus-1.so.3"};
+ dbus_handle = LoadLib(libname);
+ if(!dbus_handle)
+ {
+ WARN("Failed to load %s\n", libname);
+ return;
+ }
+
auto load_func = [](auto &f, const char *name) -> void
- { f = al::bit_cast<std::remove_reference_t<decltype(f)>>(GetSymbol(dbus_handle, name)); };
+ { f = reinterpret_cast<std::remove_reference_t<decltype(f)>>(GetSymbol(dbus_handle, name)); };
#define LOAD_FUNC(x) do { \
load_func(p##x, #x); \
if(!p##x) \
@@ -29,14 +35,8 @@ void PrepareDBus()
} \
} while(0);
- dbus_handle = LoadLib(libname);
- if(!dbus_handle)
- {
- WARN("Failed to load %s\n", libname);
- return;
- }
+ DBUS_FUNCTIONS(LOAD_FUNC)
-DBUS_FUNCTIONS(LOAD_FUNC)
#undef LOAD_FUNC
}
#endif