aboutsummaryrefslogtreecommitdiffstats
path: root/router
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
committerSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
commitec98cdacc85ff0202852472c7756586437912f22 (patch)
tree42414746a27ab35cb8cdbc95af521d74821e57f4 /router
parentfd5269bec9a5fe4815974b1786a037e6a247bfd2 (diff)
parentb82cd2e60edb8fbe5fdd3567105ae76a016a554c (diff)
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'router')
-rw-r--r--router/al.cpp19
-rw-r--r--router/alc.cpp13
-rw-r--r--router/router.cpp11
3 files changed, 24 insertions, 19 deletions
diff --git a/router/al.cpp b/router/al.cpp
index 6ed8a626..57c8d179 100644
--- a/router/al.cpp
+++ b/router/al.cpp
@@ -1,37 +1,42 @@
#include "config.h"
-#include <stddef.h>
+#include <cstddef>
#include "AL/al.h"
#include "router.h"
-#define DECL_THUNK1(R,n,T1) AL_API R AL_APIENTRY n(T1 a) noexcept \
+#define DECL_THUNK1(R,n,T1) \
+AL_API auto AL_APIENTRY n(T1 a) noexcept -> R \
{ \
DriverIface *iface = GetThreadDriver(); \
if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
return iface->n(a); \
}
-#define DECL_THUNK2(R,n,T1,T2) AL_API R AL_APIENTRY n(T1 a, T2 b) noexcept \
+#define DECL_THUNK2(R,n,T1,T2) \
+AL_API auto AL_APIENTRY n(T1 a, T2 b) noexcept -> R \
{ \
DriverIface *iface = GetThreadDriver(); \
if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
return iface->n(a, b); \
}
-#define DECL_THUNK3(R,n,T1,T2,T3) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c) noexcept \
+#define DECL_THUNK3(R,n,T1,T2,T3) \
+AL_API auto AL_APIENTRY n(T1 a, T2 b, T3 c) noexcept -> R \
{ \
DriverIface *iface = GetThreadDriver(); \
if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
return iface->n(a, b, c); \
}
-#define DECL_THUNK4(R,n,T1,T2,T3,T4) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d) noexcept \
+#define DECL_THUNK4(R,n,T1,T2,T3,T4) \
+AL_API auto AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d) noexcept -> R \
{ \
DriverIface *iface = GetThreadDriver(); \
if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
return iface->n(a, b, c, d); \
}
-#define DECL_THUNK5(R,n,T1,T2,T3,T4,T5) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d, T5 e) noexcept \
+#define DECL_THUNK5(R,n,T1,T2,T3,T4,T5) \
+AL_API auto AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d, T5 e) noexcept -> R \
{ \
DriverIface *iface = GetThreadDriver(); \
if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
@@ -42,7 +47,7 @@
/* Ugly hack for some apps calling alGetError without a current context, and
* expecting it to be AL_NO_ERROR.
*/
-AL_API ALenum AL_APIENTRY alGetError(void) noexcept
+AL_API auto AL_APIENTRY alGetError() noexcept -> ALenum
{
DriverIface *iface = GetThreadDriver();
if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire);
diff --git a/router/alc.cpp b/router/alc.cpp
index fe9faa45..71deaf0b 100644
--- a/router/alc.cpp
+++ b/router/alc.cpp
@@ -6,9 +6,10 @@
#include <string.h>
#include <stdio.h>
-#include <mutex>
#include <algorithm>
#include <array>
+#include <mutex>
+#include <tuple>
#include "AL/alc.h"
#include "alstring.h"
@@ -413,12 +414,12 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename) noexcep
{
std::lock_guard<std::recursive_mutex> _{EnumerationLock};
if(DevicesList.Names.empty())
- (void)alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
+ std::ignore = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
idx = GetDriverIndexForName(&DevicesList, devicename);
if(idx < 0)
{
if(AllDevicesList.Names.empty())
- (void)alcGetString(nullptr, ALC_ALL_DEVICES_SPECIFIER);
+ std::ignore = alcGetString(nullptr, ALC_ALL_DEVICES_SPECIFIER);
idx = GetDriverIndexForName(&AllDevicesList, devicename);
}
}
@@ -578,7 +579,7 @@ ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context) noexcept
ContextIfaceMap.removeByKey(context);
}
-ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void) noexcept
+ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext() noexcept
{
DriverIface *iface = GetThreadDriver();
if(!iface) iface = CurrentCtxDriver.load();
@@ -884,7 +885,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename,
{
std::lock_guard<std::recursive_mutex> _{EnumerationLock};
if(CaptureDevicesList.Names.empty())
- (void)alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER);
+ std::ignore = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER);
idx = GetDriverIndexForName(&CaptureDevicesList, devicename);
}
@@ -1009,7 +1010,7 @@ ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context) noexcep
return ALC_FALSE;
}
-ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void) noexcept
+ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext() noexcept
{
DriverIface *iface = GetThreadDriver();
if(iface) return iface->alcGetThreadContext();
diff --git a/router/router.cpp b/router/router.cpp
index e2ba91d1..1fdf45ac 100644
--- a/router/router.cpp
+++ b/router/router.cpp
@@ -20,7 +20,7 @@
enum LogLevel LogLevel = LogLevel_Error;
FILE *LogFile;
-static void LoadDriverList(void);
+static void LoadDriverList();
BOOL APIENTRY DllMain(HINSTANCE, DWORD reason, void*)
@@ -313,7 +313,7 @@ static int GetLoadedModuleDirectory(const WCHAR *name, WCHAR *moddir, DWORD leng
return 1;
}
-void LoadDriverList(void)
+void LoadDriverList()
{
WCHAR dll_path[MAX_PATH+1] = L"";
WCHAR cwd_path[MAX_PATH+1] = L"";
@@ -361,7 +361,7 @@ void LoadDriverList(void)
PtrIntMap::~PtrIntMap()
{
std::lock_guard<std::mutex> maplock{mLock};
- al_free(mKeys);
+ free(mKeys);
mKeys = nullptr;
mValues = nullptr;
mSize = 0;
@@ -382,8 +382,7 @@ ALenum PtrIntMap::insert(void *key, int value)
ALsizei newcap{mCapacity ? (mCapacity<<1) : 4};
if(newcap > mCapacity)
newkeys = static_cast<void**>(
- al_calloc(16, (sizeof(mKeys[0])+sizeof(mValues[0]))*newcap)
- );
+ calloc(newcap, sizeof(mKeys[0])+sizeof(mValues[0])));
if(!newkeys)
return AL_OUT_OF_MEMORY;
auto newvalues = reinterpret_cast<int*>(&newkeys[newcap]);
@@ -393,7 +392,7 @@ ALenum PtrIntMap::insert(void *key, int value)
std::copy_n(mKeys, mSize, newkeys);
std::copy_n(mValues, mSize, newvalues);
}
- al_free(mKeys);
+ free(mKeys);
mKeys = newkeys;
mValues = newvalues;
mCapacity = newcap;