From 88355ada5f4594c5aeb619a6c308dd0602b9e570 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 16 Aug 2019 04:11:27 -0400 Subject: [PATCH] General: Convert typedefs into using aliases --- include/boo/graphicsdev/D3D.hpp | 2 +- include/boo/inputdev/DeviceSignature.hpp | 5 +++-- include/boo/inputdev/IHIDListener.hpp | 6 +++--- lib/audiodev/AudioMatrixSSE.cpp | 4 ++-- lib/audiodev/WASAPI.cpp | 8 ++++---- lib/win/ApplicationUWP.cpp | 2 +- lib/win/ApplicationWin32.cpp | 4 ++-- lib/win/Win32Common.hpp | 2 +- lib/win/WinCommon.hpp | 4 ++-- lib/x11/WindowXlib.cpp | 2 +- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/include/boo/graphicsdev/D3D.hpp b/include/boo/graphicsdev/D3D.hpp index 72e406a..ff716ab 100644 --- a/include/boo/graphicsdev/D3D.hpp +++ b/include/boo/graphicsdev/D3D.hpp @@ -9,7 +9,7 @@ #include #include -typedef HRESULT(WINAPI* pD3DCreateBlob)(SIZE_T Size, ID3DBlob** ppBlob); +using pD3DCreateBlob = HRESULT(WINAPI*)(SIZE_T Size, ID3DBlob** ppBlob); extern pD3DCreateBlob D3DCreateBlobPROC; namespace boo { diff --git a/include/boo/inputdev/DeviceSignature.hpp b/include/boo/inputdev/DeviceSignature.hpp index 855842e..d3d691d 100644 --- a/include/boo/inputdev/DeviceSignature.hpp +++ b/include/boo/inputdev/DeviceSignature.hpp @@ -16,8 +16,9 @@ class DeviceBase; #define dev_typeid(type) std::hash()(#type) struct DeviceSignature { - typedef std::vector TDeviceSignatureSet; - typedef std::function(DeviceToken*)> TFactoryLambda; + using TDeviceSignatureSet = std::vector; + using TFactoryLambda = std::function(DeviceToken*)>; + const char* m_name = nullptr; uint64_t m_typeHash = 0; unsigned m_vid = 0; diff --git a/include/boo/inputdev/IHIDListener.hpp b/include/boo/inputdev/IHIDListener.hpp index d68e2bf..e81f9b8 100644 --- a/include/boo/inputdev/IHIDListener.hpp +++ b/include/boo/inputdev/IHIDListener.hpp @@ -5,11 +5,11 @@ #include "DeviceToken.hpp" namespace boo { - -typedef std::unordered_map> TDeviceTokens; -typedef std::pair TInsertedDeviceToken; class DeviceFinder; +using TDeviceTokens = std::unordered_map>; +using TInsertedDeviceToken = std::pair; + class IHIDListener { public: virtual ~IHIDListener() = default; diff --git a/lib/audiodev/AudioMatrixSSE.cpp b/lib/audiodev/AudioMatrixSSE.cpp index 23826d6..af83a60 100644 --- a/lib/audiodev/AudioMatrixSSE.cpp +++ b/lib/audiodev/AudioMatrixSSE.cpp @@ -6,13 +6,13 @@ namespace boo { -typedef union { +union TVectorUnion { float v[4]; #if __SSE__ __m128 q; __m64 d[2]; #endif -} TVectorUnion; +}; static constexpr TVectorUnion Min32Vec = {{INT32_MIN, INT32_MIN, INT32_MIN, INT32_MIN}}; static constexpr TVectorUnion Max32Vec = {{INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX}}; diff --git a/lib/audiodev/WASAPI.cpp b/lib/audiodev/WASAPI.cpp index cf33d81..0e9d62f 100644 --- a/lib/audiodev/WASAPI.cpp +++ b/lib/audiodev/WASAPI.cpp @@ -12,12 +12,12 @@ #ifdef TE_VIRTUAL_MIDI #include -typedef LPVM_MIDI_PORT(CALLBACK* pfnvirtualMIDICreatePortEx2)(LPCWSTR portName, LPVM_MIDI_DATA_CB callback, +using pfnvirtualMIDICreatePortEx2 = LPVM_MIDI_PORT(CALLBACK*)(LPCWSTR portName, LPVM_MIDI_DATA_CB callback, DWORD_PTR dwCallbackInstance, DWORD maxSysexLength, DWORD flags); -typedef void(CALLBACK* pfnvirtualMIDIClosePort)(LPVM_MIDI_PORT midiPort); -typedef BOOL(CALLBACK* pfnvirtualMIDISendData)(LPVM_MIDI_PORT midiPort, LPBYTE midiDataBytes, DWORD length); -typedef LPCWSTR(CALLBACK* pfnvirtualMIDIGetDriverVersion)(PWORD major, PWORD minor, PWORD release, PWORD build); +using pfnvirtualMIDIClosePort = void(CALLBACK*)(LPVM_MIDI_PORT midiPort); +using pfnvirtualMIDISendData = BOOL(CALLBACK*)(LPVM_MIDI_PORT midiPort, LPBYTE midiDataBytes, DWORD length); +using pfnvirtualMIDIGetDriverVersion = LPCWSTR(CALLBACK*)(PWORD major, PWORD minor, PWORD release, PWORD build); static pfnvirtualMIDICreatePortEx2 virtualMIDICreatePortEx2PROC = nullptr; static pfnvirtualMIDIClosePort virtualMIDIClosePortPROC = nullptr; static pfnvirtualMIDISendData virtualMIDISendDataPROC = nullptr; diff --git a/lib/win/ApplicationUWP.cpp b/lib/win/ApplicationUWP.cpp index dcb5c69..83879b8 100644 --- a/lib/win/ApplicationUWP.cpp +++ b/lib/win/ApplicationUWP.cpp @@ -60,7 +60,7 @@ public: , m_pname(pname) , m_args(args) , m_singleInstance(singleInstance) { - typedef HRESULT(WINAPI * CreateDXGIFactory1PROC)(REFIID riid, _COM_Outptr_ void** ppFactory); + using CreateDXGIFactory1PROC = HRESULT (WINAPI *)(REFIID riid, _COM_Outptr_ void** ppFactory); CreateDXGIFactory1PROC MyCreateDXGIFactory1 = CreateDXGIFactory1; bool no12 = true; diff --git a/lib/win/ApplicationWin32.cpp b/lib/win/ApplicationWin32.cpp index 21517bd..b628285 100644 --- a/lib/win/ApplicationWin32.cpp +++ b/lib/win/ApplicationWin32.cpp @@ -110,8 +110,8 @@ public: if (!dxgilib) Log.report(logvisor::Fatal, fmt("unable to load dxgi.dll")); - typedef HRESULT(WINAPI * CreateDXGIFactory1PROC)(REFIID riid, _COM_Outptr_ void** ppFactory); - CreateDXGIFactory1PROC MyCreateDXGIFactory1 = (CreateDXGIFactory1PROC)GetProcAddress(dxgilib, "CreateDXGIFactory1"); + using CreateDXGIFactory1PROC = HRESULT(WINAPI*)(REFIID riid, _COM_Outptr_ void** ppFactory); + auto MyCreateDXGIFactory1 = (CreateDXGIFactory1PROC)GetProcAddress(dxgilib, "CreateDXGIFactory1"); if (!MyCreateDXGIFactory1) Log.report(logvisor::Fatal, fmt("unable to find CreateDXGIFactory1 in DXGI.dll\n")); diff --git a/lib/win/Win32Common.hpp b/lib/win/Win32Common.hpp index 1d59abf..f861c4a 100644 --- a/lib/win/Win32Common.hpp +++ b/lib/win/Win32Common.hpp @@ -20,7 +20,7 @@ extern std::condition_variable g_nwcv; #if _WIN32_WINNT_WINBLUE && !WINDOWS_STORE #include -typedef HRESULT(WINAPI* PFN_GetScaleFactorForMonitor)(_In_ HMONITOR, _Out_ DEVICE_SCALE_FACTOR*); +using PFN_GetScaleFactorForMonitor = HRESULT(WINAPI*)(_In_ HMONITOR, _Out_ DEVICE_SCALE_FACTOR*); extern PFN_GetScaleFactorForMonitor MyGetScaleFactorForMonitor; #endif diff --git a/lib/win/WinCommon.hpp b/lib/win/WinCommon.hpp index ac26c19..7573914 100644 --- a/lib/win/WinCommon.hpp +++ b/lib/win/WinCommon.hpp @@ -25,8 +25,8 @@ class IWindow; #include -typedef int (WINAPI *pD3DPERF_BeginEvent)(D3DCOLOR col, LPCWSTR wszName); -typedef int (WINAPI *pD3DPERF_EndEvent)(); +using pD3DPERF_BeginEvent = int (WINAPI*)(D3DCOLOR col, LPCWSTR wszName); +using pD3DPERF_EndEvent = int (WINAPI*)(); struct D3D12Context { ComPtr m_dxFactory; diff --git a/lib/x11/WindowXlib.cpp b/lib/x11/WindowXlib.cpp index 08db84b..b229bd7 100644 --- a/lib/x11/WindowXlib.cpp +++ b/lib/x11/WindowXlib.cpp @@ -59,7 +59,7 @@ #undef False #undef True -typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*); +using glXCreateContextAttribsARBProc = GLXContext (*)(Display*, GLXFBConfig, GLXContext, Bool, const int*); static glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0; static bool s_glxError; static int ctxErrorHandler(Display* dpy, XErrorEvent* ev) {