diff options
author | Chris Robinson <[email protected]> | 2018-12-28 16:13:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-28 16:13:28 -0800 |
commit | 67b874328d60062558eeb5068a3f79dab2b6f7e3 (patch) | |
tree | 39a560044c569a5b53c910241ef1917333a107cd /Alc | |
parent | 01ed98c99bc66f4df589d73c3ec9e97c9387d4f7 (diff) |
Use static_cast instead of reinterpret_cast where possible
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/dsound.cpp | 2 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.cpp | 6 | ||||
-rw-r--r-- | Alc/backends/wasapi.cpp | 32 |
3 files changed, 20 insertions, 20 deletions
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp index 83cc712f..832068ad 100644 --- a/Alc/backends/dsound.cpp +++ b/Alc/backends/dsound.cpp @@ -158,7 +158,7 @@ BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHAR* UNUS if(!guid) return TRUE; - auto& devices = *reinterpret_cast<al::vector<DevMap>*>(data); + auto& devices = *static_cast<al::vector<DevMap>*>(data); const std::string basename{DEVNAME_HEAD + wstr_to_utf8(desc)}; int count{1}; diff --git a/Alc/backends/pulseaudio.cpp b/Alc/backends/pulseaudio.cpp index 60307e94..a99503e1 100644 --- a/Alc/backends/pulseaudio.cpp +++ b/Alc/backends/pulseaudio.cpp @@ -371,7 +371,7 @@ pa_proplist *prop_filter; /* PulseAudio Event Callbacks */ void context_state_callback(pa_context *context, void *pdata) { - auto loop = reinterpret_cast<pa_threaded_mainloop*>(pdata); + auto loop = static_cast<pa_threaded_mainloop*>(pdata); pa_context_state_t state{pa_context_get_state(context)}; if(state == PA_CONTEXT_READY || !PA_CONTEXT_IS_GOOD(state)) pa_threaded_mainloop_signal(loop, 0); @@ -379,7 +379,7 @@ void context_state_callback(pa_context *context, void *pdata) void stream_state_callback(pa_stream *stream, void *pdata) { - auto loop = reinterpret_cast<pa_threaded_mainloop*>(pdata); + auto loop = static_cast<pa_threaded_mainloop*>(pdata); pa_stream_state_t state{pa_stream_get_state(stream)}; if(state == PA_STREAM_READY || !PA_STREAM_IS_GOOD(state)) pa_threaded_mainloop_signal(loop, 0); @@ -387,7 +387,7 @@ void stream_state_callback(pa_stream *stream, void *pdata) void stream_success_callback(pa_stream *UNUSED(stream), int UNUSED(success), void *pdata) { - auto loop = reinterpret_cast<pa_threaded_mainloop*>(pdata); + auto loop = static_cast<pa_threaded_mainloop*>(pdata); pa_threaded_mainloop_signal(loop, 0); } diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp index 11bc06e4..5c97324e 100644 --- a/Alc/backends/wasapi.cpp +++ b/Alc/backends/wasapi.cpp @@ -353,7 +353,7 @@ struct WasapiProxy { DWORD WasapiProxy::messageHandler(void *ptr) { - auto req = reinterpret_cast<ThreadRequest*>(ptr); + auto req = static_cast<ThreadRequest*>(ptr); TRACE("Starting message thread\n"); @@ -365,8 +365,8 @@ DWORD WasapiProxy::messageHandler(void *ptr) return 0; } - HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_INPROC_SERVER, - IID_IMMDeviceEnumerator, &ptr); + HRESULT hr{CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_INPROC_SERVER, + IID_IMMDeviceEnumerator, &ptr)}; if(FAILED(hr)) { WARN("Failed to create IMMDeviceEnumerator instance: 0x%08lx\n", hr); @@ -374,7 +374,7 @@ DWORD WasapiProxy::messageHandler(void *ptr) ReturnMsgResponse(req, hr); return 0; } - auto Enumerator = reinterpret_cast<IMMDeviceEnumerator*>(ptr); + auto Enumerator = static_cast<IMMDeviceEnumerator*>(ptr); Enumerator->Release(); Enumerator = nullptr; @@ -466,7 +466,7 @@ DWORD WasapiProxy::messageHandler(void *ptr) hr = CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_INPROC_SERVER, IID_IMMDeviceEnumerator, &ptr); if(SUCCEEDED(hr)) { - Enumerator = reinterpret_cast<IMMDeviceEnumerator*>(ptr); + Enumerator = static_cast<IMMDeviceEnumerator*>(ptr); if(msg.lParam == ALL_DEVICE_PROBE) hr = probe_devices(Enumerator, eRender, PlaybackDevices); @@ -757,10 +757,10 @@ ALCenum WasapiPlayback_open(WasapiPlayback *self, const ALCchar *deviceName) HRESULT WasapiPlayback::openProxy() { void *ptr; - HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_INPROC_SERVER, IID_IMMDeviceEnumerator, &ptr); + HRESULT hr{CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_INPROC_SERVER, IID_IMMDeviceEnumerator, &ptr)}; if(SUCCEEDED(hr)) { - auto Enumerator = reinterpret_cast<IMMDeviceEnumerator*>(ptr); + auto Enumerator = static_cast<IMMDeviceEnumerator*>(ptr); if(mDevId.empty()) hr = Enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &mMMDev); else @@ -771,7 +771,7 @@ HRESULT WasapiPlayback::openProxy() hr = mMMDev->Activate(IID_IAudioClient, CLSCTX_INPROC_SERVER, nullptr, &ptr); if(SUCCEEDED(hr)) { - mClient = reinterpret_cast<IAudioClient*>(ptr); + mClient = static_cast<IAudioClient*>(ptr); if(mDevice->DeviceName.empty()) mDevice->DeviceName = get_device_name_and_guid(mMMDev).first; } @@ -823,7 +823,7 @@ HRESULT WasapiPlayback::resetProxy() ERR("Failed to reactivate audio client: 0x%08lx\n", hr); return hr; } - mClient = reinterpret_cast<IAudioClient*>(ptr); + mClient = static_cast<IAudioClient*>(ptr); WAVEFORMATEX *wfx; hr = mClient->GetMixFormat(&wfx); @@ -1093,7 +1093,7 @@ HRESULT WasapiPlayback::startProxy() hr = mClient->GetService(IID_IAudioRenderClient, &ptr); if(SUCCEEDED(hr)) { - mRender = reinterpret_cast<IAudioRenderClient*>(ptr); + mRender = static_cast<IAudioRenderClient*>(ptr); try { mKillNow.store(AL_FALSE, std::memory_order_release); mThread = std::thread{std::mem_fn(&WasapiPlayback::mixerProc), this}; @@ -1421,11 +1421,11 @@ ALCenum WasapiCapture_open(WasapiCapture *self, const ALCchar *deviceName) HRESULT WasapiCapture::openProxy() { void *ptr; - HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_INPROC_SERVER, - IID_IMMDeviceEnumerator, &ptr); + HRESULT hr{CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_INPROC_SERVER, + IID_IMMDeviceEnumerator, &ptr)}; if(SUCCEEDED(hr)) { - auto Enumerator = reinterpret_cast<IMMDeviceEnumerator*>(ptr); + auto Enumerator = static_cast<IMMDeviceEnumerator*>(ptr); if(mDevId.empty()) hr = Enumerator->GetDefaultAudioEndpoint(eCapture, eMultimedia, &mMMDev); else @@ -1436,7 +1436,7 @@ HRESULT WasapiCapture::openProxy() hr = mMMDev->Activate(IID_IAudioClient, CLSCTX_INPROC_SERVER, nullptr, &ptr); if(SUCCEEDED(hr)) { - mClient = reinterpret_cast<IAudioClient*>(ptr); + mClient = static_cast<IAudioClient*>(ptr); if(mDevice->DeviceName.empty()) mDevice->DeviceName = get_device_name_and_guid(mMMDev).first; } @@ -1475,7 +1475,7 @@ HRESULT WasapiCapture::resetProxy() ERR("Failed to reactivate audio client: 0x%08lx\n", hr); return hr; } - mClient = reinterpret_cast<IAudioClient*>(ptr); + mClient = static_cast<IAudioClient*>(ptr); REFERENCE_TIME buf_time{ScaleCeil(mDevice->UpdateSize*mDevice->NumUpdates, REFTIME_PER_SEC, mDevice->Frequency)}; @@ -1721,7 +1721,7 @@ HRESULT WasapiCapture::startProxy() hr = mClient->GetService(IID_IAudioCaptureClient, &ptr); if(SUCCEEDED(hr)) { - mCapture = reinterpret_cast<IAudioCaptureClient*>(ptr); + mCapture = static_cast<IAudioCaptureClient*>(ptr); try { mKillNow.store(AL_FALSE, std::memory_order_release); mThread = std::thread{std::mem_fn(&WasapiCapture::recordProc), this}; |