From fd8386a20641fe521803e3d5bfddc9a79cb0fef2 Mon Sep 17 00:00:00 2001 From: Popkornium18 Date: Sun, 28 Jun 2020 00:17:36 +0200 Subject: [PATCH 1/2] REFAC(overlay): replace NULL with nullptr This changes all occurances of NULL in the overlay source dir to nullptr. Additionally explicit comparisons with NULL were removed. --- overlay/D11StateBlock.cpp | 14 ++-- overlay/HardHook_minhook.cpp | 18 ++--- overlay/HardHook_x86.cpp | 22 +++--- overlay/ancestor.cpp | 4 +- overlay/d3d10.cpp | 102 ++++++++++++++-------------- overlay/d3d11.cpp | 92 ++++++++++++------------- overlay/d3d9.cpp | 78 ++++++++++----------- overlay/dxgi.cpp | 10 +-- overlay/lib.cpp | 80 +++++++++++----------- overlay/olsettings.cpp | 22 +++--- overlay/opengl.cpp | 14 ++-- overlay/overlay_blacklist.h | 2 +- overlay/overlay_exe/overlay_exe.cpp | 12 ++-- overlay/overlay_exe/overlay_exe.h | 2 +- overlay/overlay_launchers.h | 2 +- overlay/overlay_whitelist.h | 2 +- 16 files changed, 237 insertions(+), 239 deletions(-) diff --git a/overlay/D11StateBlock.cpp b/overlay/D11StateBlock.cpp index 4a00fb820..ca1bfea9a 100644 --- a/overlay/D11StateBlock.cpp +++ b/overlay/D11StateBlock.cpp @@ -97,40 +97,40 @@ void D11StateBlock::ReleaseObjects() { if (pRasterizerState) { pRasterizerState->Release(); - pRasterizerState = NULL; + pRasterizerState = nullptr; } for (int i=0; iRelease(); - pRenderTargetViews[i] = NULL; + pRenderTargetViews[i] = nullptr; } if (pDepthStencilView) { pDepthStencilView->Release(); - pDepthStencilView = NULL; + pDepthStencilView = nullptr; } if (pBlendState) { pBlendState->Release(); - pBlendState = NULL; + pBlendState = nullptr; } if (pInputLayout) { pInputLayout->Release(); - pInputLayout = NULL; + pInputLayout = nullptr; } if (pIndexBuffer) { pIndexBuffer->Release(); - pIndexBuffer = NULL; + pIndexBuffer = nullptr; } for (int i=0; iRelease(); - pVertexBuffers[i] = NULL; + pVertexBuffers[i] = nullptr; } } diff --git a/overlay/HardHook_minhook.cpp b/overlay/HardHook_minhook.cpp index eafdd55d8..bd0bb2afe 100644 --- a/overlay/HardHook_minhook.cpp +++ b/overlay/HardHook_minhook.cpp @@ -27,9 +27,9 @@ static void EnsureMinHookInitialized() { * @brief Constructs a new hook without actually injecting. */ HardHook::HardHook() - : m_func(NULL) - , m_replacement(NULL) - , call(NULL) { + : m_func(nullptr) + , m_replacement(nullptr) + , call(nullptr) { EnsureMinHookInitialized(); } @@ -40,9 +40,9 @@ HardHook::HardHook() * @param replacement Function to inject into func. */ HardHook::HardHook(voidFunc func, voidFunc replacement) - : m_func(NULL) - , m_replacement(NULL) - , call(NULL) { + : m_func(nullptr) + , m_replacement(nullptr) + , call(nullptr) { EnsureMinHookInitialized(); setup(func, replacement); @@ -76,9 +76,9 @@ void HardHook::setupInterface(IUnknown *unkn, LONG funcoffset, voidFunc replacem } void HardHook::reset() { - m_func = NULL; - m_replacement = NULL; - call = NULL; + m_func = nullptr; + m_replacement = nullptr; + call = nullptr; } /** diff --git a/overlay/HardHook_x86.cpp b/overlay/HardHook_x86.cpp index 82f6a878f..7c16ba54f 100644 --- a/overlay/HardHook_x86.cpp +++ b/overlay/HardHook_x86.cpp @@ -6,7 +6,7 @@ #include "HardHook.h" #include "ods.h" -void *HardHook::pCode = NULL; +void *HardHook::pCode = nullptr; unsigned int HardHook::uiCode = 0; const int HardHook::CODEREPLACESIZE = 6; @@ -15,7 +15,7 @@ const int HardHook::CODEPROTECTSIZE = 16; /** * @brief Constructs a new hook without actually injecting. */ -HardHook::HardHook() : bTrampoline(false), call(0), baseptr(NULL) { +HardHook::HardHook() : bTrampoline(false), call(0), baseptr(nullptr) { for (int i = 0; i < CODEREPLACESIZE; ++i) { orig[i] = replace[i] = 0; } @@ -31,7 +31,7 @@ HardHook::HardHook() : bTrampoline(false), call(0), baseptr(NULL) { * @param replacement Function to inject into func. */ HardHook::HardHook(voidFunc func, voidFunc replacement) - : bTrampoline(false), call(0), baseptr(NULL) { + : bTrampoline(false), call(0), baseptr(nullptr) { for (int i = 0; i < CODEREPLACESIZE; ++i) orig[i] = replace[i] = 0; setup(func, replacement); @@ -84,7 +84,7 @@ static unsigned int modrmbytes(unsigned char a, unsigned char b) { * for all trampolines). * * If code is encountered that can not be moved into the trampoline (conditionals etc.) - * construction fails and NULL is returned. If enough commands can be saved the + * construction fails and nullptr is returned. If enough commands can be saved the * trampoline is finalized by appending a jump back to the original code. The return value * in this case will be the address of the newly constructed trampoline. * @@ -92,17 +92,17 @@ static unsigned int modrmbytes(unsigned char a, unsigned char b) { * [SAVED CODE FROM ORIGINAL which is >= CODEREPLACESIZE bytes][JUMP BACK TO ORIGINAL CODE] * * @param porig Original code - * @return Pointer to trampoline on success. NULL if trampoline construction failed. + * @return Pointer to trampoline on success. nullptr if trampoline construction failed. */ void *HardHook::cloneCode(void **porig) { if (! pCode || uiCode > 4000) { - pCode = VirtualAlloc(NULL, 4096, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); + pCode = VirtualAlloc(nullptr, 4096, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); uiCode = 0; } // If we have no memory to clone to, return. if (! pCode) { - return NULL; + return nullptr; } unsigned char *o = (unsigned char *) *porig; @@ -110,7 +110,7 @@ void *HardHook::cloneCode(void **porig) { DWORD origProtect; if (!VirtualProtect(o, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) { fods("HardHook: CloneCode failed; failed to make original code read and executable"); - return NULL; + return nullptr; } // Follow relative jumps to next instruction. On execution it doesn't make @@ -129,7 +129,7 @@ void *HardHook::cloneCode(void **porig) { VirtualProtect(tmp, CODEPROTECTSIZE, origProtect, &tempProtect); if (!VirtualProtect(o, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) { fods("HardHook: CloneCode failed; failed to make jump target code read and executable"); - return NULL; + return nullptr; } } @@ -187,7 +187,7 @@ void *HardHook::cloneCode(void **porig) { opcode, idx, o[0], o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9], o[10], o[11]); DWORD tempProtect; VirtualProtect(o, CODEPROTECTSIZE, origProtect, &tempProtect); - return NULL; + return nullptr; break; } } @@ -284,7 +284,7 @@ void HardHook::setupInterface(IUnknown *unkn, LONG funcoffset, voidFunc replacem void HardHook::reset() { baseptr = 0; bTrampoline = false; - call = NULL; + call = nullptr; for (int i = 0; i < CODEREPLACESIZE; ++i) { orig[i] = replace[i] = 0; } diff --git a/overlay/ancestor.cpp b/overlay/ancestor.cpp index e0eb63f4b..404a9639c 100644 --- a/overlay/ancestor.cpp +++ b/overlay/ancestor.cpp @@ -16,7 +16,7 @@ /// Returns false on failure, and does not touch |parent|. static bool findParentProcessForChild(DWORD childpid, PROCESSENTRY32 *parent) { DWORD parentpid = 0; - HANDLE hSnap = NULL; + HANDLE hSnap = nullptr; bool done = false; PROCESSENTRY32 pe; @@ -78,7 +78,7 @@ static bool findParentProcessForChild(DWORD childpid, PROCESSENTRY32 *parent) { /// Returns true on success, and fills out |module| with the proper MODULEENTRY32 entry. /// Returns false on failure, and does not touch |module|. static bool getModuleForParent(PROCESSENTRY32 *parent, MODULEENTRY32 *module) { - HANDLE hSnap = NULL; + HANDLE hSnap = nullptr; bool done = false; MODULEENTRY32 me; diff --git a/overlay/d3d10.cpp b/overlay/d3d10.cpp index 4d8f6eafe..5eb7aedd6 100644 --- a/overlay/d3d10.cpp +++ b/overlay/d3d10.cpp @@ -8,7 +8,7 @@ #include #include -D3D10Data *d3d10 = NULL; +D3D10Data *d3d10 = nullptr; static bool bHooked = false; static HardHook hhAddRef; @@ -96,18 +96,18 @@ D10State::D10State(IDXGISwapChain *pSwapChain, ID3D10Device *pDevice) { lHighMark = initRefCount = refCount = myRefCount = 0; ZeroMemory(&vp, sizeof(vp)); - pOrigStateBlock = NULL; - pMyStateBlock = NULL; - pRTV = NULL; - pEffect = NULL; - pTechnique = NULL; - pDiffuseTexture = NULL; - pVertexLayout = NULL; - pVertexBuffer = NULL; - pIndexBuffer = NULL; - pBlendState = NULL; - pTexture = NULL; - pSRView = NULL; + pOrigStateBlock = nullptr; + pMyStateBlock = nullptr; + pRTV = nullptr; + pEffect = nullptr; + pTechnique = nullptr; + pDiffuseTexture = nullptr; + pVertexLayout = nullptr; + pVertexBuffer = nullptr; + pIndexBuffer = nullptr; + pBlendState = nullptr; + pTexture = nullptr; + pSRView = nullptr; timeT = clock(); frameCount = 0; @@ -174,7 +174,7 @@ void D10State::setRect() { { SimpleVec3(left, bottom, 0.5f), SimpleVec2(texl, texb) }, }; - void *pData = NULL; + void *pData = nullptr; hr = pVertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pData); memcpy(pData, vertices, sizeof(vertices)); @@ -189,11 +189,11 @@ void D10State::newTexture(unsigned int w, unsigned int h) { if (pTexture) { pTexture->Release(); - pTexture = NULL; + pTexture = nullptr; } if (pSRView) { pSRView->Release(); - pSRView = NULL; + pSRView = nullptr; } D3D10_TEXTURE2D_DESC desc; @@ -207,10 +207,10 @@ void D10State::newTexture(unsigned int w, unsigned int h) { desc.Usage = D3D10_USAGE_DYNAMIC; desc.BindFlags = D3D10_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; - hr = pDevice->CreateTexture2D(&desc, NULL, &pTexture); + hr = pDevice->CreateTexture2D(&desc, nullptr, &pTexture); if (FAILED(hr)) { - pTexture = NULL; + pTexture = nullptr; ods("D3D10: Failed to create texture."); return; } @@ -224,9 +224,9 @@ void D10State::newTexture(unsigned int w, unsigned int h) { hr = pDevice->CreateShaderResourceView(pTexture, &srvDesc, &pSRView); if (FAILED(hr)) { - pSRView = NULL; + pSRView = nullptr; pTexture->Release(); - pTexture = NULL; + pTexture = nullptr; ods("D3D10: Failed to create resource view."); return; } @@ -237,9 +237,7 @@ bool D10State::init() { static HMODREF(GetModuleHandleW(L"D3D10.DLL"), D3D10CreateStateBlock); static HMODREF(GetModuleHandleW(L"D3D10.DLL"), D3D10StateBlockMaskEnableAll); - if (pD3D10CreateEffectFromMemory == NULL - || pD3D10CreateStateBlock == NULL - || pD3D10StateBlockMaskEnableAll == NULL) { + if (!pD3D10CreateEffectFromMemory || !pD3D10CreateStateBlock || !pD3D10StateBlockMaskEnableAll) { ods("D3D10: Could not get handles for all required D3D10 state initialization functions"); return false; } @@ -272,7 +270,7 @@ bool D10State::init() { return false; } - ID3D10Texture2D *pBackBuffer = NULL; + ID3D10Texture2D *pBackBuffer = nullptr; hr = pSwapChain->GetBuffer(0, __uuidof(*pBackBuffer), (LPVOID*)&pBackBuffer); if (FAILED(hr)) { ods("D3D10: pSwapChain->GetBuffer failure!"); @@ -293,13 +291,13 @@ bool D10State::init() { vp.TopLeftY = 0; pDevice->RSSetViewports(1, &vp); - hr = pDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRTV); + hr = pDevice->CreateRenderTargetView(pBackBuffer, nullptr, &pRTV); if (FAILED(hr)) { ods("D3D10: pDevice->CreateRenderTargetView failed!"); return false; } - pDevice->OMSetRenderTargets(1, &pRTV, NULL); + pDevice->OMSetRenderTargets(1, &pRTV, nullptr); // Settings for an "over" operation. // https://en.wikipedia.org/w/index.php?title=Alpha_compositing&oldid=580659153#Description @@ -320,28 +318,28 @@ bool D10State::init() { return false; } - pDevice->OMSetBlendState(pBlendState, NULL, 0xffffffff); + pDevice->OMSetBlendState(pBlendState, nullptr, 0xffffffff); - hr = pD3D10CreateEffectFromMemory((void *) g_main, sizeof(g_main), 0, pDevice, NULL, &pEffect); + hr = pD3D10CreateEffectFromMemory((void *) g_main, sizeof(g_main), 0, pDevice, nullptr, &pEffect); if (FAILED(hr)) { ods("D3D10: D3D10CreateEffectFromMemory failed!"); return false; } pTechnique = pEffect->GetTechniqueByName("Render"); - if (pTechnique == NULL) { + if (!pTechnique) { ods("D3D10: Could not get technique for name 'Render'"); return false; } pDiffuseTexture = pEffect->GetVariableByName("txDiffuse")->AsShaderResource(); - if (pDiffuseTexture == NULL) { + if (!pDiffuseTexture) { ods("D3D10: Could not get variable by name 'txDiffuse'"); return false; } - pTexture = NULL; - pSRView = NULL; + pTexture = nullptr; + pSRView = nullptr; // Define the input layout D3D10_INPUT_ELEMENT_DESC layout[] = { @@ -374,7 +372,7 @@ bool D10State::init() { bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; bd.MiscFlags = 0; - hr = pDevice->CreateBuffer(&bd, NULL, &pVertexBuffer); + hr = pDevice->CreateBuffer(&bd, nullptr, &pVertexBuffer); if (FAILED(hr)) { ods("D3D10: pDevice->CreateBuffer failure!"); return false; @@ -424,14 +422,14 @@ bool D10State::init() { } D10State::~D10State() { - if (pBlendState != NULL) pBlendState->Release(); - if (pVertexBuffer != NULL) pVertexBuffer->Release(); - if (pIndexBuffer != NULL) pIndexBuffer->Release(); - if (pVertexLayout != NULL) pVertexLayout->Release(); - if (pEffect != NULL) pEffect->Release(); - if (pRTV != NULL) pRTV->Release(); - if (pTexture != NULL) pTexture->Release(); - if (pSRView != NULL) pSRView->Release(); + if (pBlendState) pBlendState->Release(); + if (pVertexBuffer) pVertexBuffer->Release(); + if (pIndexBuffer) pIndexBuffer->Release(); + if (pVertexLayout) pVertexLayout->Release(); + if (pEffect) pEffect->Release(); + if (pRTV) pRTV->Release(); + if (pTexture) pTexture->Release(); + if (pSRView) pSRView->Release(); if (pMyStateBlock) { pMyStateBlock->ReleaseAllDeviceObjects(); @@ -491,19 +489,19 @@ void D10State::draw() { // D3D10 specific logic for the Present function. void presentD3D10(IDXGISwapChain *pSwapChain) { - ID3D10Device *pDevice = NULL; + ID3D10Device *pDevice = nullptr; HRESULT hr = pSwapChain->GetDevice(__uuidof(ID3D10Device), (void **) &pDevice); if (SUCCEEDED(hr) && pDevice) { SwapchainMap::iterator it = chains.find(pSwapChain); - D10State *ds = it != chains.end() ? it->second : NULL; + D10State *ds = it != chains.end() ? it->second : nullptr; if (ds && ds->pDevice != pDevice) { ods("D3D10: SwapChain device changed"); devices.erase(ds->pDevice); delete ds; - ds = NULL; + ds = nullptr; } - if (ds == NULL) { + if (!ds) { ods("D3D10: New state"); ds = new D10State(pSwapChain, pDevice); if (!ds->init()) { @@ -578,7 +576,7 @@ static ULONG __stdcall myRelease(ID3D10Device *pDevice) { chains.erase(ds->pSwapChain); delete ds; ods("D3D10: Deleted"); - ds = NULL; + ds = nullptr; } } @@ -629,7 +627,7 @@ void checkDXGI10Hook(bool preonly) { void hookD3D10(HMODULE hD3D10, bool preonly) { // Add a ref to ourselves; we do NOT want to get unloaded directly from this process. - HMODULE hTempSelf = NULL; + HMODULE hTempSelf = nullptr; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast(&hookD3D10), &hTempSelf); bHooked = true; @@ -665,11 +663,11 @@ void PrepareDXGI10(IDXGIAdapter1 *pAdapter, bool initializeDXGIData) { HMODULE hD3D10 = LoadLibrary("D3D10.DLL"); - if (hD3D10 != NULL) { + if (hD3D10) { HWND hwnd = CreateWindowW(L"STATIC", L"Mumble DXGI Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, 0, - NULL, NULL, 0); + nullptr, nullptr, 0); D3D10CreateDeviceAndSwapChainType pD3D10CreateDeviceAndSwapChain = reinterpret_cast(GetProcAddress(hD3D10, "D3D10CreateDeviceAndSwapChain")); @@ -702,9 +700,9 @@ void PrepareDXGI10(IDXGIAdapter1 *pAdapter, bool initializeDXGIData) { desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; - IDXGISwapChain *pSwapChain = NULL; - ID3D10Device *pDevice = NULL; - HRESULT hr = pD3D10CreateDeviceAndSwapChain(pAdapter, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &desc, &pSwapChain, &pDevice); + IDXGISwapChain *pSwapChain = nullptr; + ID3D10Device *pDevice = nullptr; + HRESULT hr = pD3D10CreateDeviceAndSwapChain(pAdapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, D3D10_SDK_VERSION, &desc, &pSwapChain, &pDevice); if (FAILED(hr)) ods("D3D10: pD3D10CreateDeviceAndSwapChain failure!"); diff --git a/overlay/d3d11.cpp b/overlay/d3d11.cpp index 05ef1ff64..89453565e 100644 --- a/overlay/d3d11.cpp +++ b/overlay/d3d11.cpp @@ -42,7 +42,7 @@ #include #include -D3D11Data *d3d11 = NULL; +D3D11Data *d3d11 = nullptr; static bool bHooked = false; static HardHook hhAddRef; @@ -129,18 +129,18 @@ D11State::D11State(IDXGISwapChain *pSwapChain, ID3D11Device *pDevice) ZeroMemory(&vp, sizeof(vp)); - pOrigStateBlock = NULL; - pMyStateBlock = NULL; - pRTV = NULL; - pVertexShader = NULL; - pPixelShader = NULL; - pVertexLayout = NULL; - pVertexBuffer = NULL; - pIndexBuffer = NULL; - pBlendState = NULL; - pTexture = NULL; - pSRView = NULL; - pDeviceContext = NULL; + pOrigStateBlock = nullptr; + pMyStateBlock = nullptr; + pRTV = nullptr; + pVertexShader = nullptr; + pPixelShader = nullptr; + pVertexLayout = nullptr; + pVertexBuffer = nullptr; + pIndexBuffer = nullptr; + pBlendState = nullptr; + pTexture = nullptr; + pSRView = nullptr; + pDeviceContext = nullptr; timeT = clock(); frameCount = 0; @@ -225,11 +225,11 @@ void D11State::newTexture(unsigned int w, unsigned int h) { if (pTexture) { pTexture->Release(); - pTexture = NULL; + pTexture = nullptr; } if (pSRView) { pSRView->Release(); - pSRView = NULL; + pSRView = nullptr; } D3D11_TEXTURE2D_DESC desc; @@ -243,10 +243,10 @@ void D11State::newTexture(unsigned int w, unsigned int h) { desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - hr = pDevice->CreateTexture2D(&desc, NULL, &pTexture); + hr = pDevice->CreateTexture2D(&desc, nullptr, &pTexture); if (FAILED(hr)) { - pTexture = NULL; + pTexture = nullptr; ods("D3D11: Failed to create texture."); return; } @@ -260,9 +260,9 @@ void D11State::newTexture(unsigned int w, unsigned int h) { hr = pDevice->CreateShaderResourceView(pTexture, &srvDesc, &pSRView); if (FAILED(hr)) { - pSRView = NULL; + pSRView = nullptr; pTexture->Release(); - pTexture = NULL; + pTexture = nullptr; ods("D3D11: Failed to create resource view."); return; } @@ -271,7 +271,7 @@ void D11State::newTexture(unsigned int w, unsigned int h) { bool D11State::init() { HRESULT hr; - ID3D11Texture2D* pBackBuffer = NULL; + ID3D11Texture2D* pBackBuffer = nullptr; hr = pSwapChain->GetBuffer(0, __uuidof(*pBackBuffer), (LPVOID*)&pBackBuffer); if (FAILED(hr)) { ods("D3D11: pSwapChain->GetBuffer failure!"); @@ -308,13 +308,13 @@ bool D11State::init() { vp.TopLeftY = 0; pDeviceContext->RSSetViewports(1, &vp); - hr = pDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRTV); + hr = pDevice->CreateRenderTargetView(pBackBuffer, nullptr, &pRTV); if (FAILED(hr)) { ods("D3D11: pDevice->CreateRenderTargetView failed!"); return false; } - pDeviceContext->OMSetRenderTargets(1, &pRTV, NULL); + pDeviceContext->OMSetRenderTargets(1, &pRTV, nullptr); // Settings for an "over" operation. // https://en.wikipedia.org/w/index.php?title=Alpha_compositing&oldid=580659153#Description @@ -335,22 +335,22 @@ bool D11State::init() { return false; } - pDeviceContext->OMSetBlendState(pBlendState, NULL, 0xffffffff); + pDeviceContext->OMSetBlendState(pBlendState, nullptr, 0xffffffff); - hr = pDevice->CreateVertexShader(g_vertex_shader, sizeof(g_vertex_shader), NULL, &pVertexShader); + hr = pDevice->CreateVertexShader(g_vertex_shader, sizeof(g_vertex_shader), nullptr, &pVertexShader); if (FAILED(hr)) { ods("D3D11: Failed to create vertex shader."); return false; } - hr = pDevice->CreatePixelShader(g_pixel_shader, sizeof(g_pixel_shader), NULL, &pPixelShader); + hr = pDevice->CreatePixelShader(g_pixel_shader, sizeof(g_pixel_shader), nullptr, &pPixelShader); if (FAILED(hr)) { ods("D3D11: Failed to create pixel shader."); return false; } - pTexture = NULL; - pSRView = NULL; + pTexture = nullptr; + pSRView = nullptr; // Define the input layout D3D11_INPUT_ELEMENT_DESC layout[] = { @@ -374,7 +374,7 @@ bool D11State::init() { bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; bd.MiscFlags = 0; - hr = pDevice->CreateBuffer(&bd, NULL, &pVertexBuffer); + hr = pDevice->CreateBuffer(&bd, nullptr, &pVertexBuffer); if (FAILED(hr)) { ods("D3D11: pDevice->CreateBuffer failure!"); return false; @@ -438,9 +438,9 @@ D11State::~D11State() { pSRView->Release(); delete pMyStateBlock; - pMyStateBlock = NULL; + pMyStateBlock = nullptr; delete pOrigStateBlock; - pOrigStateBlock = NULL; + pOrigStateBlock = nullptr; if (pDeviceContext) pDeviceContext->Release(); @@ -476,16 +476,16 @@ void D11State::draw() { UINT offset = 0; pDeviceContext->IASetVertexBuffers(0, 1, &pVertexBuffer, &stride, &offset); - pDeviceContext->VSSetShader(pVertexShader, NULL, 0); - pDeviceContext->GSSetShader(NULL, NULL, 0); + pDeviceContext->VSSetShader(pVertexShader, nullptr, 0); + pDeviceContext->GSSetShader(nullptr, nullptr, 0); pDeviceContext->PSSetShaderResources(0, 1, &pSRView); - pDeviceContext->PSSetShader(pPixelShader, NULL, 0); + pDeviceContext->PSSetShader(pPixelShader, nullptr, 0); pDeviceContext->DrawIndexed(6, 0, 0); if (bDeferredContext) { ID3D11CommandList *pCommandList; pDeviceContext->FinishCommandList(TRUE, &pCommandList); - ID3D11DeviceContext *ctx = NULL; + ID3D11DeviceContext *ctx = nullptr; pDevice->GetImmediateContext(&ctx); ctx->ExecuteCommandList(pCommandList, TRUE); ctx->Release(); @@ -502,18 +502,18 @@ void D11State::draw() { // D3D11 specific logic for the Present function. extern void presentD3D11(IDXGISwapChain *pSwapChain) { - ID3D11Device *pDevice = NULL; + ID3D11Device *pDevice = nullptr; HRESULT hr = pSwapChain->GetDevice(__uuidof(ID3D11Device), (void **) &pDevice); if (SUCCEEDED(hr) && pDevice) { SwapchainMap::iterator it = chains.find(pSwapChain); - D11State *ds = it != chains.end() ? it->second : NULL; + D11State *ds = it != chains.end() ? it->second : nullptr; if (ds && ds->pDevice != pDevice) { ods("D3D11: SwapChain device changed"); devices.erase(ds->pDevice); delete ds; - ds = NULL; + ds = nullptr; } - if (ds == NULL) { + if (!ds) { ods("D3D11: New state"); ds = new D11State(pSwapChain, pDevice); if (!ds->init()) { @@ -586,7 +586,7 @@ static ULONG __stdcall myRelease(ID3D11Device *pDevice) { chains.erase(ds->pSwapChain); delete ds; ods("D3D11: Deleted"); - ds = NULL; + ds = nullptr; } } @@ -638,7 +638,7 @@ void checkDXGI11Hook(bool preonly) { void hookD3D11(HMODULE hD3D11, bool preonly) { // Add a ref to ourselves; we do NOT want to get unloaded directly from this process. - HMODULE hTempSelf = NULL; + HMODULE hTempSelf = nullptr; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast(&hookD3D11), &hTempSelf); bHooked = true; @@ -675,11 +675,11 @@ void PrepareDXGI11(IDXGIAdapter1* pAdapter, bool initializeDXGIData) { HMODULE hD3D11 = LoadLibrary("D3D11.DLL"); - if (hD3D11 != NULL) { + if (hD3D11) { HWND hwnd = CreateWindowW(L"STATIC", L"Mumble DXGI Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, 0, - NULL, NULL, 0); + nullptr, nullptr, 0); D3D11CreateDeviceAndSwapChainType pD3D11CreateDeviceAndSwapChain = reinterpret_cast(GetProcAddress(hD3D11, "D3D11CreateDeviceAndSwapChain")); @@ -713,11 +713,11 @@ void PrepareDXGI11(IDXGIAdapter1* pAdapter, bool initializeDXGIData) { desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; - IDXGISwapChain *pSwapChain = NULL; - ID3D11Device *pDevice = NULL; + IDXGISwapChain *pSwapChain = nullptr; + ID3D11Device *pDevice = nullptr; D3D_FEATURE_LEVEL featureLevel; - ID3D11DeviceContext *pDeviceContext = NULL; - HRESULT hr = pD3D11CreateDeviceAndSwapChain(pAdapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, 0, NULL, 0, D3D11_SDK_VERSION, &desc, &pSwapChain, &pDevice, &featureLevel, &pDeviceContext); + ID3D11DeviceContext *pDeviceContext = nullptr; + HRESULT hr = pD3D11CreateDeviceAndSwapChain(pAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, nullptr, 0, D3D11_SDK_VERSION, &desc, &pSwapChain, &pDevice, &featureLevel, &pDeviceContext); if (FAILED(hr)) ods("D3D11: pD3D11CreateDeviceAndSwapChain failure!"); diff --git a/overlay/d3d9.cpp b/overlay/d3d9.cpp index 2bf328c11..c5dcb87f4 100644 --- a/overlay/d3d9.cpp +++ b/overlay/d3d9.cpp @@ -7,7 +7,7 @@ #include #include -Direct3D9Data *d3dd = NULL; +Direct3D9Data *d3dd = nullptr; typedef IDirect3D9* (WINAPI *pDirect3DCreate9)(UINT SDKVersion) ; typedef HRESULT (WINAPI *pDirect3DCreate9Ex)(UINT SDKVersion, IDirect3D9Ex **ppD3D) ; @@ -79,13 +79,13 @@ static DevMapType devMap; static bool bHooked = false; DevState::DevState() { - dev = NULL; - pSB = NULL; + dev = nullptr; + pSB = nullptr; dwMyThread = 0; initRefCount = 0; refCount = 0; myRefCount = 0; - texTexture = NULL; + texTexture = nullptr; timeT = clock(); frameCount = 0; @@ -102,7 +102,7 @@ void DevState::releaseData() { if (texTexture) { texTexture->Release(); - texTexture = NULL; + texTexture = nullptr; } } @@ -118,7 +118,7 @@ void DevState::blit(unsigned int x, unsigned int y, unsigned int w, unsigned int D3DLOCKED_RECT lr; if ((x == 0) && (y == 0) && (w == uiWidth) && (h == uiHeight)) { - if (texTexture->LockRect(0, &lr, NULL, D3DLOCK_DISCARD) != D3D_OK) + if (texTexture->LockRect(0, &lr, nullptr, D3DLOCK_DISCARD) != D3D_OK) return; } else { RECT r; @@ -183,10 +183,10 @@ void DevState::newTexture(unsigned int width, unsigned int height) { if (texTexture) { texTexture->Release(); - texTexture = NULL; + texTexture = nullptr; } - dev->CreateTexture(uiWidth, uiHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texTexture, NULL); + dev->CreateTexture(uiWidth, uiHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texTexture, nullptr); for (int i = 0; i < 4; ++i) { vertices[i].x = vertices[i].y = vertices[i].z = 0.0f; @@ -200,7 +200,7 @@ void DevState::releaseAll() { releaseData(); if (pSB) pSB->Release(); - pSB = NULL; + pSB = nullptr; } void DevState::draw() { @@ -256,9 +256,9 @@ void DevState::createCleanState() { if (pSB) pSB->Release(); - pSB = NULL; + pSB = nullptr; - IDirect3DStateBlock9* pStateBlock = NULL; + IDirect3DStateBlock9* pStateBlock = nullptr; dev->CreateStateBlock(D3DSBT_ALL, &pStateBlock); if (! pStateBlock) return; @@ -274,8 +274,8 @@ void DevState::createCleanState() { D3DVIEWPORT9 vp; dev->GetViewport(&vp); - dev->SetVertexShader(NULL); - dev->SetPixelShader(NULL); + dev->SetVertexShader(nullptr); + dev->SetPixelShader(nullptr); dev->SetFVF(D3DFVF_TLVERTEX); dev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); @@ -320,10 +320,10 @@ static HardHook hhSwapPresent; /// Present the overlay. /// /// If called via IDirect3DDevice9::present() or IDirect3DDevice9Ex::present(), -/// idd will be non-NULL and ids ill be NULL. +/// idd will be non-nullptr and ids ill be nullptr. /// /// If called via IDirect3DSwapChain9::present(), both idd and ids will be -/// non-NULL. +/// non-nullptr. /// /// The doPresent function expects the following assumptions to be valid: /// @@ -339,7 +339,7 @@ static HardHook hhSwapPresent; /// every frame, etc. static void doPresent(IDirect3DDevice9 *idd, IDirect3DSwapChain9 *ids) { DevMapType::iterator it = devMap.find(idd); - DevState *ds = it != devMap.end() ? it->second : NULL; + DevState *ds = it != devMap.end() ? it->second : nullptr; HRESULT hres; if (ds && ds->pSB) { @@ -351,7 +351,7 @@ static void doPresent(IDirect3DDevice9 *idd, IDirect3DSwapChain9 *ids) { // Get the back buffer. // If we're called via IDirect3DSwapChain9, acquire it via the swap chain object. // Otherwise, acquire it via the device itself. - IDirect3DSurface9 *pTarget = NULL; + IDirect3DSurface9 *pTarget = nullptr; if (ids) { hres = ids->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pTarget); if (FAILED(hres)) { @@ -372,7 +372,7 @@ static void doPresent(IDirect3DDevice9 *idd, IDirect3DSwapChain9 *ids) { } } - IDirect3DSurface9 *pRenderTarget = NULL; + IDirect3DSurface9 *pRenderTarget = nullptr; hres = idd->GetRenderTarget(0, &pRenderTarget); if (FAILED(hres)) { if (hres == D3DERR_NOTFOUND) { @@ -389,7 +389,7 @@ static void doPresent(IDirect3DDevice9 *idd, IDirect3DSwapChain9 *ids) { ods("D3D9: doPresent BackB %p RenderT %p", pTarget, pRenderTarget); #endif - IDirect3DStateBlock9* pStateBlock = NULL; + IDirect3DStateBlock9* pStateBlock = nullptr; idd->CreateStateBlock(D3DSBT_ALL, &pStateBlock); pStateBlock->Capture(); @@ -462,7 +462,7 @@ static HRESULT __stdcall mySwapPresent(IDirect3DSwapChain9 *ids, CONST RECT *pSo ods("D3D9: SwapChain Present"); #endif - IDirect3DDevice9 *idd = NULL; + IDirect3DDevice9 *idd = nullptr; ids->GetDevice(&idd); if (idd) { doPresent(idd, ids); @@ -486,7 +486,7 @@ static HRESULT __stdcall myPresent(IDirect3DDevice9 *idd, CONST RECT *pSourceRec ods("D3D9: Device Present"); #endif - doPresent(idd, NULL); + doPresent(idd, nullptr); //TODO: Move logic to HardHook. // Call base without active hook in case of no trampoline. @@ -505,7 +505,7 @@ static HRESULT __stdcall myPresentEx(IDirect3DDevice9Ex *idd, CONST RECT *pSourc ods("D3D9: Device Present Ex"); #endif - doPresent(idd, NULL); + doPresent(idd, nullptr); PresentExType oPresentEx = (PresentExType) hhPresentEx.call; hhPresentEx.restore(); @@ -520,7 +520,7 @@ static HRESULT __stdcall myReset(IDirect3DDevice9 *idd, D3DPRESENT_PARAMETERS *p ods("D3D9: Chaining Reset"); DevMapType::iterator it = devMap.find(idd); - DevState *ds = it != devMap.end() ? it->second : NULL; + DevState *ds = it != devMap.end() ? it->second : nullptr; if (ds) { if (ds->dwMyThread != 0) { ods("D3D9: myReset from other thread"); @@ -548,7 +548,7 @@ static HRESULT __stdcall myResetEx(IDirect3DDevice9Ex *idd, D3DPRESENT_PARAMETER ods("D3D9: Chaining ResetEx"); DevMapType::iterator it = devMap.find(idd); - DevState *ds = it != devMap.end() ? it->second : NULL; + DevState *ds = it != devMap.end() ? it->second : nullptr; if (ds) { if (ds->dwMyThread) { ods("D3D9: myResetEx from other thread"); @@ -577,7 +577,7 @@ static ULONG __stdcall myAddRef(IDirect3DDevice9 *idd) { Mutex m; DevMapType::iterator it = devMap.find(idd); - DevState *ds = it != devMap.end() ? it->second : NULL; + DevState *ds = it != devMap.end() ? it->second : nullptr; if (ds) { // AddRef is called very often. Thus, we do not want to always log here. #ifdef EXTENDED_OVERLAY_DEBUGOUTPUT @@ -611,7 +611,7 @@ static ULONG __stdcall myWin8AddRef(IDirect3DDevice9 *idd) { Mutex m; DevMapType::iterator it = devMap.find(idd); - DevState *ds = it != devMap.end() ? it->second : NULL; + DevState *ds = it != devMap.end() ? it->second : nullptr; if (ds && ds->dwMyThread == GetCurrentThreadId()) { // AddRef is called very often. Thus, we do not want to always log here. #ifdef EXTENDED_OVERLAY_DEBUGOUTPUT @@ -646,7 +646,7 @@ static ULONG __stdcall myRelease(IDirect3DDevice9 *idd) { Mutex m; DevMapType::iterator it = devMap.find(idd); - DevState *ds = it != devMap.end() ? it->second : NULL; + DevState *ds = it != devMap.end() ? it->second : nullptr; if (ds) { // Release is called very often. Thus, we do not want to always log here. #ifdef EXTENDED_OVERLAY_DEBUGOUTPUT @@ -685,7 +685,7 @@ static ULONG __stdcall myRelease(IDirect3DDevice9 *idd) { devMap.erase(it); delete ds; - ds = NULL; + ds = nullptr; } //TODO: Move logic to HardHook. @@ -707,7 +707,7 @@ static ULONG __stdcall myWin8Release(IDirect3DDevice9 *idd) { Mutex m; DevMapType::iterator it = devMap.find(idd); - DevState *ds = it != devMap.end() ? it->second : NULL; + DevState *ds = it != devMap.end() ? it->second : nullptr; if (ds) { // Release is called very often. Thus, we do not want to always log here. #ifdef EXTENDED_OVERLAY_DEBUGOUTPUT @@ -738,7 +738,7 @@ static ULONG __stdcall myWin8Release(IDirect3DDevice9 *idd) { devMap.erase(it); delete ds; - ds = NULL; + ds = nullptr; } } @@ -762,11 +762,11 @@ static ULONG __stdcall myWin8Release(IDirect3DDevice9 *idd) { static IDirect3DDevice9* findOriginalDevice(IDirect3DDevice9 *device) { - IDirect3DSwapChain9 *pSwap = NULL; + IDirect3DSwapChain9 *pSwap = nullptr; device->GetSwapChain(0, &pSwap); if (pSwap) { - IDirect3DDevice9 *originalDevice = NULL; + IDirect3DDevice9 *originalDevice = nullptr; if (SUCCEEDED(pSwap->GetDevice(&originalDevice))) { if (originalDevice == device) { @@ -847,7 +847,7 @@ static HRESULT __stdcall myCreateDevice(IDirect3D9 *id3d, UINT Adapter, D3DDEVTY hhReset.setupInterface(idd, offsetReset, reinterpret_cast(myReset)); hhPresent.setupInterface(idd, offsetPresent, reinterpret_cast(myPresent)); - IDirect3DSwapChain9 *pSwap = NULL; + IDirect3DSwapChain9 *pSwap = nullptr; idd->GetSwapChain(0, &pSwap); if (pSwap) { // The offset is dependent on the declaration order of the struct. @@ -919,7 +919,7 @@ static HRESULT __stdcall myCreateDeviceEx(IDirect3D9Ex *id3d, UINT Adapter, D3DD hhPresent.setupInterface(idd, offsetPresent, reinterpret_cast(myPresent)); hhPresentEx.setupInterface(idd, offsetPresentEx, reinterpret_cast(myPresentEx)); - IDirect3DSwapChain9 *pSwap = NULL; + IDirect3DSwapChain9 *pSwap = nullptr; idd->GetSwapChain(0, &pSwap); if (pSwap) { // The offset is dependent on the declaration order of the struct. @@ -977,7 +977,7 @@ void checkD3D9Hook(bool preonly) { HMODULE hD3D = GetModuleHandle("D3D9.DLL"); - if (hD3D != NULL) { + if (hD3D) { if (! bHooked) { hookD3D9(hD3D, preonly); } @@ -993,11 +993,11 @@ void checkD3D9Hook(bool preonly) { static void hookD3D9(HMODULE hD3D, bool preonly) { char procname[MODULEFILEPATH_BUFLEN]; - GetModuleFileName(NULL, procname, ARRAY_NUM_ELEMENTS(procname)); + GetModuleFileName(nullptr, procname, ARRAY_NUM_ELEMENTS(procname)); ods("D3D9: hookD3D9 in App '%s'", procname); // Add a ref to ourselves; we do NOT want to get unloaded directly from this process. - HMODULE hTempSelf = NULL; + HMODULE hTempSelf = nullptr; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast(&hookD3D9), &hTempSelf); bHooked = true; @@ -1067,7 +1067,7 @@ extern "C" __declspec(dllexport) void __cdecl PrepareD3D9() { HMODULE hD3D = LoadLibrary("D3D9.DLL"); - if (hD3D != NULL) { + if (hD3D) { GetModuleFileNameW(hD3D, d3dd->wcFileName, ARRAY_NUM_ELEMENTS(d3dd->wcFileName)); @@ -1105,7 +1105,7 @@ extern "C" __declspec(dllexport) void __cdecl PrepareD3D9() { if (!IsFnInModule(reinterpret_cast(d3dcreate9ex), d3dd->wcFileName, "D3D9", d3d9exFnName)) { ods(("D3D9: " + d3d9exFnName + " is not in D3D9 library").c_str()); } else { - IDirect3D9Ex *id3d9 = NULL; + IDirect3D9Ex *id3d9 = nullptr; d3dcreate9ex(D3D_SDK_VERSION, &id3d9); if (id3d9) { void ***vtbl = (void ***) id3d9; diff --git a/overlay/dxgi.cpp b/overlay/dxgi.cpp index 7b51550e5..f71da9165 100644 --- a/overlay/dxgi.cpp +++ b/overlay/dxgi.cpp @@ -38,7 +38,7 @@ #include "lib.h" #include -DXGIData *dxgi = NULL; +DXGIData *dxgi = nullptr; static bool bHooked = false; static HardHook hhPresent; @@ -143,11 +143,11 @@ void checkDXGIHook(bool preonly) { /// @param hDXGI must be a valid module handle. void hookDXGI(HMODULE hDXGI, bool preonly) { wchar_t modulename[MODULEFILEPATH_BUFLEN]; - GetModuleFileNameW(NULL, modulename, ARRAY_NUM_ELEMENTS(modulename)); + GetModuleFileNameW(nullptr, modulename, ARRAY_NUM_ELEMENTS(modulename)); ods("DXGI: hookDXGI in App '%ls'", modulename); // Add a ref to ourselves; we do NOT want to get unloaded directly from this process. - HMODULE hTempSelf = NULL; + HMODULE hTempSelf = nullptr; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast(&hookDXGI), &hTempSelf); bHooked = true; @@ -199,7 +199,7 @@ extern "C" __declspec(dllexport) void __cdecl PrepareDXGI() { HMODULE hDXGI = LoadLibrary("DXGI.DLL"); - if (hDXGI != NULL) { + if (hDXGI) { GetModuleFileNameW(hDXGI, dxgi->wcFileName, ARRAY_NUM_ELEMENTS(dxgi->wcFileName)); CreateDXGIFactory1Type pCreateDXGIFactory1 = reinterpret_cast(GetProcAddress(hDXGI, "CreateDXGIFactory1")); @@ -210,7 +210,7 @@ extern "C" __declspec(dllexport) void __cdecl PrepareDXGI() { if (FAILED(hr)) ods("DXGI: Call to pCreateDXGIFactory1 failed!"); if (pFactory) { - IDXGIAdapter1 *pAdapter = NULL; + IDXGIAdapter1 *pAdapter = nullptr; pFactory->EnumAdapters1(0, &pAdapter); /// Offsets have to be identified and initialized only once. diff --git a/overlay/lib.cpp b/overlay/lib.cpp index ddc766bf5..779b6ada2 100644 --- a/overlay/lib.cpp +++ b/overlay/lib.cpp @@ -8,8 +8,8 @@ #include "overlay_exe/overlay_exe.h" -static HANDLE hMapObject = NULL; -static HANDLE hHookMutex = NULL; +static HANDLE hMapObject = nullptr; +static HANDLE hHookMutex = nullptr; static HHOOK hhookWnd = 0; BOOL bIsWin8 = FALSE; @@ -21,7 +21,7 @@ static BOOL bEnableOverlay = TRUE; static HardHook hhLoad; static HardHook hhLoadW; -static SharedData *sd = NULL; +static SharedData *sd = nullptr; CRITICAL_SECTION Mutex::cs; @@ -61,8 +61,8 @@ void __cdecl checkForWPF() { Pipe::Pipe() { hSocket = INVALID_HANDLE_VALUE; - hMemory = NULL; - a_ucTexture = NULL; + hMemory = nullptr; + a_ucTexture = nullptr; omMsg.omh.iLength = -1; @@ -79,10 +79,10 @@ Pipe::~Pipe() { void Pipe::release() { if (hMemory) { CloseHandle(hMemory); - hMemory = NULL; + hMemory = nullptr; if (a_ucTexture) { UnmapViewOfFile(a_ucTexture); - a_ucTexture = NULL; + a_ucTexture = nullptr; } uiLeft = uiRight = uiTop = uiBottom = 0; @@ -105,7 +105,7 @@ bool Pipe::sendMessage(const OverlayMsg &om) { DWORD dwBytesToWrite = sizeof(OverlayMsgHeader) + om.omh.iLength; DWORD dwBytesWritten = dwBytesToWrite; - if (WriteFile(hSocket, om.headerbuffer, sizeof(OverlayMsgHeader) + om.omh.iLength, &dwBytesWritten, NULL)) + if (WriteFile(hSocket, om.headerbuffer, sizeof(OverlayMsgHeader) + om.omh.iLength, &dwBytesWritten, nullptr)) if (dwBytesToWrite == dwBytesWritten) return true; @@ -119,7 +119,7 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { return; if (hSocket == INVALID_HANDLE_VALUE) { - hSocket = CreateFileW(L"\\\\.\\pipe\\MumbleOverlayPipe", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + hSocket = CreateFileW(L"\\\\.\\pipe\\MumbleOverlayPipe", GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr); if (hSocket == INVALID_HANDLE_VALUE) { ods("Pipe: Connection failed"); return; @@ -169,7 +169,7 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { DWORD dwBytesLeft; DWORD dwBytesRead; - if (! PeekNamedPipe(hSocket, NULL, 0, NULL, &dwBytesLeft, NULL)) { + if (! PeekNamedPipe(hSocket, nullptr, 0, nullptr, &dwBytesLeft, nullptr)) { ods("Pipe: Could not peek"); disconnect(); return; @@ -179,7 +179,7 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { break; if (omMsg.omh.iLength == -1) { - if (! ReadFile(hSocket, reinterpret_cast(omMsg.headerbuffer) + dwAlreadyRead, sizeof(OverlayMsgHeader) - dwAlreadyRead, &dwBytesRead, NULL)) { + if (! ReadFile(hSocket, reinterpret_cast(omMsg.headerbuffer) + dwAlreadyRead, sizeof(OverlayMsgHeader) - dwAlreadyRead, &dwBytesRead, nullptr)) { ods("Pipe: Read header fail"); disconnect(); return; @@ -204,7 +204,7 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { continue; } - if (! ReadFile(hSocket, reinterpret_cast(omMsg.msgbuffer) + dwAlreadyRead, omMsg.omh.iLength - dwAlreadyRead, &dwBytesRead, NULL)) { + if (! ReadFile(hSocket, reinterpret_cast(omMsg.msgbuffer) + dwAlreadyRead, omMsg.omh.iLength - dwAlreadyRead, &dwBytesRead, nullptr)) { ods("Pipe: Read data fail"); disconnect(); return; @@ -226,13 +226,13 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { release(); - hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, uiWidth * uiHeight * 4, memname); + hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, uiWidth * uiHeight * 4, memname); if (GetLastError() != ERROR_ALREADY_EXISTS) { ods("Pipe: Memory %s(%d) => %ls doesn't exist", omMsg.oms.a_cName, omMsg.omh.iLength, memname); if (hMemory) { CloseHandle(hMemory); - hMemory = NULL; + hMemory = nullptr; break; } } @@ -244,10 +244,10 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { a_ucTexture = reinterpret_cast(MapViewOfFile(hMemory, FILE_MAP_ALL_ACCESS, 0, 0, 0)); - if (a_ucTexture == NULL) { + if (!a_ucTexture) { ods("Pipe: Failed to map memory"); CloseHandle(hMemory); - hMemory = NULL; + hMemory = nullptr; break; } @@ -257,8 +257,8 @@ void Pipe::checkMessage(unsigned int width, unsigned int height) { ods("Pipe: Memory too small"); UnmapViewOfFile(a_ucTexture); CloseHandle(hMemory); - a_ucTexture = NULL; - hMemory = NULL; + a_ucTexture = nullptr; + hMemory = nullptr; break; } @@ -373,10 +373,10 @@ static LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam) { extern "C" __declspec(dllexport) void __cdecl RemoveHooks() { DWORD dwWaitResult = WaitForSingleObject(hHookMutex, 1000L); if (dwWaitResult == WAIT_OBJECT_0) { - if (sd != NULL && sd->bHooked) { + if (sd && sd->bHooked) { if (hhookWnd) { UnhookWindowsHookEx(hhookWnd); - hhookWnd = NULL; + hhookWnd = nullptr; } sd->bHooked = false; } @@ -387,14 +387,14 @@ extern "C" __declspec(dllexport) void __cdecl RemoveHooks() { extern "C" __declspec(dllexport) void __cdecl InstallHooks() { DWORD dwWaitResult = WaitForSingleObject(hHookMutex, 1000L); if (dwWaitResult == WAIT_OBJECT_0) { - if (sd != NULL && ! sd->bHooked) { - HMODULE hSelf = NULL; + if (sd && ! sd->bHooked) { + HMODULE hSelf = nullptr; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, reinterpret_cast(&InstallHooks), &hSelf); - if (hSelf == NULL) { + if (!hSelf) { ods("Lib: Failed to find myself"); } else { hhookWnd = SetWindowsHookEx(WH_CBT, CallWndProc, hSelf, 0); - if (hhookWnd == NULL) + if (!hhookWnd) ods("Lib: Failed to insert WNDProc hook"); } @@ -430,8 +430,8 @@ extern "C" __declspec(dllexport) int __cdecl OverlayHelperProcessMain(unsigned i return OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH; } - HANDLE pcheckHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) OverlayHelperProcessParentDeathThread, - reinterpret_cast(parent), 0, NULL); + HANDLE pcheckHandle = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE) OverlayHelperProcessParentDeathThread, + reinterpret_cast(parent), 0, nullptr); if (pcheckHandle == 0) { return OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR; } @@ -445,7 +445,7 @@ extern "C" __declspec(dllexport) int __cdecl OverlayHelperProcessMain(unsigned i MSG msg; BOOL ret; - ret = GetMessage(&msg, NULL, 0, 0); + ret = GetMessage(&msg, nullptr, 0, 0); // The ret variable is set to 0 on WM_QUIT, // and -1 on error. @@ -478,7 +478,7 @@ static bool createSharedDataMap(); // we shouldn't inject into it. static void checkNoOverlayFile(const std::string &dir) { std::string nooverlay = dir + "\\nooverlay"; - HANDLE h = CreateFile(nooverlay.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE h = CreateFile(nooverlay.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (h != INVALID_HANDLE_VALUE) { CloseHandle(h); ods("Lib: Overlay disable %s found", dir.c_str()); @@ -493,7 +493,7 @@ static void checkNoOverlayFile(const std::string &dir) { static void checkDebugOverlayFile(const std::string &dir) { // check for "debugoverlay" file, which would enable overlay debugging std::string debugoverlay = dir + "\\debugoverlay"; - HANDLE h = CreateFile(debugoverlay.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE h = CreateFile(debugoverlay.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (h != INVALID_HANDLE_VALUE) { CloseHandle(h); ods("Lib: Overlay debug %s found", debugoverlay.c_str()); @@ -509,12 +509,12 @@ static void checkDebugOverlayFile(const std::string &dir) { // Returns true on success and fills out |absExeName|, |dir| and |exeName|. // Returns false on failure, and does not touch |absExeName|, |dir| and |exeName|. static bool parseProcName(char *procname, std::string &absExeName, std::string &dir, std::string &exeName) { - if (procname == NULL) { + if (!procname) { return false; } char *p = strrchr(procname, '\\'); - if (p == NULL) { + if (!p) { return false; } @@ -535,7 +535,7 @@ static bool dllmainProcAttach(char *procname) { if (!ok) { // No blacklisting if the file has no path - } else if (GetProcAddress(NULL, "mumbleSelfDetection") != NULL) { + } else if (GetProcAddress(nullptr, "mumbleSelfDetection")) { ods("Lib: Attached to overlay helper or Mumble process. Blacklisted - no overlay injection."); bEnableOverlay = FALSE; bMumble = TRUE; @@ -561,8 +561,8 @@ static bool dllmainProcAttach(char *procname) { ods("Lib: bIsWin8: %i", bIsWin8); - hHookMutex = CreateMutex(NULL, false, "MumbleHookMutex"); - if (hHookMutex == NULL) { + hHookMutex = CreateMutex(nullptr, false, "MumbleHookMutex"); + if (!hHookMutex) { ods("Lib: CreateMutex failed"); return false; } @@ -593,8 +593,8 @@ static bool createSharedDataMap() { # error Unsupported architecture #endif - hMapObject = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, dwSharedSize, name); - if (hMapObject == NULL) { + hMapObject = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, dwSharedSize, name); + if (!hMapObject) { ods("Lib: CreateFileMapping failed"); return false; } @@ -605,7 +605,7 @@ static bool createSharedDataMap() { unsigned char *rawSharedPointer = static_cast( MapViewOfFile(hMapObject, FILE_MAP_ALL_ACCESS, 0, 0, dwSharedSize)); - if (rawSharedPointer == NULL) { + if (!rawSharedPointer) { ods("Lib: MapViewOfFile failed"); return false; } @@ -661,7 +661,7 @@ static void dllmainThreadAttach() { extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID) { char procname[PROCNAMEFILEPATH_EXTENDED_BUFFER_BUFLEN]; - GetModuleFileNameA(NULL, procname, ARRAY_NUM_ELEMENTS(procname)); + GetModuleFileNameA(nullptr, procname, ARRAY_NUM_ELEMENTS(procname)); // Fix for windows XP; on length nSize does not include null-termination // @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms683197%28v=vs.85%29.aspx procname[ARRAY_NUM_ELEMENTS(procname) - 1] = '\0'; @@ -689,7 +689,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID) { bool IsFnInModule(voidFunc fnptr, wchar_t *refmodulepath, const std::string &logPrefix, const std::string &fnName) { - HMODULE hModule = NULL; + HMODULE hModule = nullptr; BOOL success = GetModuleHandleEx( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, @@ -706,7 +706,7 @@ bool IsFnInModule(voidFunc fnptr, wchar_t *refmodulepath, const std::string &log boost::optional GetFnOffsetInModule(voidFunc fnptr, wchar_t *refmodulepath, unsigned int refmodulepathLen, const std::string &logPrefix, const std::string &fnName) { - HMODULE hModule = NULL; + HMODULE hModule = nullptr; if (! GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, reinterpret_cast(fnptr), &hModule)) { ods((logPrefix + ": Failed to get module for " + fnName).c_str()); diff --git a/overlay/olsettings.cpp b/overlay/olsettings.cpp index 0dff81fd1..fb98c7bf6 100644 --- a/overlay/olsettings.cpp +++ b/overlay/olsettings.cpp @@ -21,7 +21,7 @@ static std::vector defaultBlacklistVector() { std::vector out; size_t i = 0; - while (overlayBlacklist[i] != NULL) { + while (overlayBlacklist[i]) { out.push_back(std::string(overlayBlacklist[i])); i++; } @@ -32,7 +32,7 @@ static std::vector defaultBlacklistVector() { static std::vector defaultWhitelistVector() { std::vector out; size_t i = 0; - while (overlayWhitelist[i] != NULL) { + while (overlayWhitelist[i]) { out.push_back(std::string(overlayWhitelist[i])); i++; } @@ -43,7 +43,7 @@ static std::vector defaultWhitelistVector() { static std::vector defaultLaunchersVector() { std::vector out; size_t i = 0; - while (overlayLaunchers[i] != NULL) { + while (overlayLaunchers[i]) { out.push_back(std::string(overlayLaunchers[i])); i++; } @@ -58,17 +58,17 @@ static std::vector regReadMultiString(HKEY key, { LONG err = 0; std::vector out; - char *buf = NULL; + char *buf = nullptr; HKEY subKeyHandle = 0; - err = RegOpenKeyExA(key, subKey.c_str(), NULL, KEY_READ, &subKeyHandle); + err = RegOpenKeyExA(key, subKey.c_str(), 0, KEY_READ, &subKeyHandle); if (err != ERROR_SUCCESS) { goto err; } DWORD sz = 0; DWORD type = 0; - err = RegQueryValueExA(subKeyHandle, valueName.c_str(), NULL, &type, NULL, &sz); + err = RegQueryValueExA(subKeyHandle, valueName.c_str(), nullptr, &type, nullptr, &sz); if (err != ERROR_SUCCESS) { goto err; } @@ -83,11 +83,11 @@ static std::vector regReadMultiString(HKEY key, } buf = reinterpret_cast(malloc(sz)); - if (buf == NULL) { + if (!buf) { goto err; } - err = RegQueryValueExA(subKeyHandle, valueName.c_str(), NULL, &type, reinterpret_cast(buf), &sz); + err = RegQueryValueExA(subKeyHandle, valueName.c_str(), nullptr, &type, reinterpret_cast(buf), &sz); if (err != ERROR_SUCCESS) { goto err; } @@ -113,16 +113,16 @@ err: // Returns -1 if the function could not read the value from the Windows registry. static int getModeInternal() { LONG err = 0; - HKEY key = NULL; + HKEY key = nullptr; DWORD mode = -1; - err = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Mumble\\Mumble\\overlay", NULL, KEY_READ, &key); + err = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Mumble\\Mumble\\overlay", 0, KEY_READ, &key); if (err != ERROR_SUCCESS) { return -1; } DWORD sz = sizeof(mode); - err = RegQueryValueExA(key, "mode", NULL, NULL, reinterpret_cast(&mode), &sz); + err = RegQueryValueExA(key, "mode", nullptr, nullptr, reinterpret_cast(&mode), &sz); if (err != ERROR_SUCCESS) { return -1; } diff --git a/overlay/opengl.cpp b/overlay/opengl.cpp index e3f696f34..ffc55aa74 100644 --- a/overlay/opengl.cpp +++ b/overlay/opengl.cpp @@ -9,7 +9,7 @@ #include "../3rdparty/GL/glext.h" #define TDEF(ret, name, arg) typedef ret (__stdcall * t##name) arg -#define GLDEF(ret, name, arg) TDEF(ret, name, arg); t##name o##name = NULL +#define GLDEF(ret, name, arg) TDEF(ret, name, arg); t##name o##name = nullptr GLDEF(HGLRC, wglCreateContext, (HDC)); GLDEF(void, glGenTextures, (GLsizei, GLuint *)); @@ -285,21 +285,21 @@ static BOOL __stdcall mywglSwapBuffers(HDC hdc) { /// Otherwise false. static bool lookupSymbols(HMODULE hGL) { #define FNFIND(handle, name) {\ - if (o##name == NULL) {\ + if (!o##name) {\ o##name = reinterpret_cast(GetProcAddress(handle, #name));\ - if (o##name == NULL) {\ + if (!o##name) {\ ods("OpenGL: Could not resolve symbol %s in %s", #name, #handle);\ return false;\ }\ }\ } - if (hGL == NULL) { + if (!hGL) { return false; } HMODULE hGDI = GetModuleHandle("GDI32.DLL"); - if (hGDI == NULL) { + if (!hGDI) { ods("OpenGL: Failed to identify GDI32"); return false; } @@ -351,11 +351,11 @@ void checkOpenGLHook() { if (lookupSymbols(hGL)) { char procname[1024]; - GetModuleFileName(NULL, procname, 1024); + GetModuleFileName(nullptr, procname, 1024); ods("OpenGL: Hooking into OpenGL App %s", procname); // Add a ref to ourselves; we do NOT want to get unloaded directly from this process. - HMODULE hTempSelf = NULL; + HMODULE hTempSelf = nullptr; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast(&checkOpenGLHook), &hTempSelf); #define INJECT(handle, name) {\ diff --git a/overlay/overlay_blacklist.h b/overlay/overlay_blacklist.h index 03440fe4f..6a0c3bfa1 100644 --- a/overlay/overlay_blacklist.h +++ b/overlay/overlay_blacklist.h @@ -64,7 +64,7 @@ static const char *overlayBlacklist[] = { "mspub.exe", // Publisher "msaccess.exe", // Access - NULL + nullptr }; #endif diff --git a/overlay/overlay_exe/overlay_exe.cpp b/overlay/overlay_exe/overlay_exe.cpp index 897df91db..460336b8b 100644 --- a/overlay/overlay_exe/overlay_exe.cpp +++ b/overlay/overlay_exe/overlay_exe.cpp @@ -24,7 +24,7 @@ extern "C" __declspec(dllexport) void mumbleSelfDetection() {}; // Alert shows a fatal error dialog and waits for the user to click OK. static void Alert(LPCWSTR title, LPCWSTR msg) { - MessageBox(NULL, msg, title, MB_OK|MB_ICONERROR); + MessageBox(nullptr, msg, title, MB_OK|MB_ICONERROR); } // GetExecutableDirPath returns the directory that @@ -32,7 +32,7 @@ static void Alert(LPCWSTR title, LPCWSTR msg) { static std::wstring GetExecutableDirPath() { wchar_t path[MAX_PATH]; - if (GetModuleFileNameW(NULL, path, MAX_PATH) == 0) + if (GetModuleFileNameW(nullptr, path, MAX_PATH) == 0) return std::wstring(); if (!PathRemoveFileSpecW(path)) @@ -79,13 +79,13 @@ static std::vector GetCommandLineArgs() { std::vector args; LPWSTR cmdLine = GetCommandLine(); - if (cmdLine == NULL) { + if (!cmdLine) { return args; } int argc = 0; LPWSTR *argv = CommandLineToArgvW(cmdLine, &argc); - if (argv == NULL) { + if (!argv) { return args; } @@ -170,7 +170,7 @@ int main(int argc, char **argv) { return OVERLAY_HELPER_ERROR_EXE_GET_DLL_PATH; } - HMODULE dll = LoadLibraryExW(absDLLPath.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + HMODULE dll = LoadLibraryExW(absDLLPath.c_str(), nullptr, LOAD_WITH_ALTERED_SEARCH_PATH); if (!dll) { return OVERLAY_HELPER_ERROR_EXE_LOAD_DLL; } @@ -189,5 +189,5 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prevInstance, wchar_t *cmdAr UNUSED(cmdArg); UNUSED(cmdShow); - return main(0, NULL); + return main(0, nullptr); } diff --git a/overlay/overlay_exe/overlay_exe.h b/overlay/overlay_exe/overlay_exe.h index c9f1e781e..4daab98fb 100644 --- a/overlay/overlay_exe/overlay_exe.h +++ b/overlay/overlay_exe/overlay_exe.h @@ -81,7 +81,7 @@ static inline const char *OverlayHelperErrorToString(OverlayHelperError err) { OHE(OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR); OHE(OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL); } - return NULL; + return nullptr; } #endif diff --git a/overlay/overlay_launchers.h b/overlay/overlay_launchers.h index dd0ef29e9..e0a6d0f49 100644 --- a/overlay/overlay_launchers.h +++ b/overlay/overlay_launchers.h @@ -21,7 +21,7 @@ static const char *overlayLaunchers[] = { "LoLPatcher.exe", // League of Legends Patcher (note: this isn't its launcher, but an intermediate process) "GTAVLauncher.exe", // Grand Theft Auto V - NULL + nullptr }; #endif diff --git a/overlay/overlay_whitelist.h b/overlay/overlay_whitelist.h index 0075936a0..614908473 100644 --- a/overlay/overlay_whitelist.h +++ b/overlay/overlay_whitelist.h @@ -11,7 +11,7 @@ static const char *overlayWhitelist[] = { "gw2.exe", "gw2-64.exe", - NULL + nullptr }; #endif From 691c38736a7061e5d8f39f2b0f47e8eb3eecc228 Mon Sep 17 00:00:00 2001 From: Popkornium18 Date: Sun, 28 Jun 2020 00:48:14 +0200 Subject: [PATCH 2/2] REFAC(plugins): replace NULL with nullptr This changes all occurances of NULL in the plugins source dir to nullptr. Additionally explicit comparisons with NULL were removed. --- plugins/aoc/aoc.cpp | 4 ++-- plugins/arma2/arma2.cpp | 4 ++-- plugins/bf1/bf1.cpp | 4 ++-- plugins/bf1942/bf1942.cpp | 4 ++-- plugins/bf2/bf2.cpp | 4 ++-- plugins/bf2142/bf2142.cpp | 4 ++-- plugins/bf3/bf3.cpp | 4 ++-- plugins/bf4/bf4.cpp | 6 +++--- plugins/bf4_x86/bf4_x86.cpp | 6 +++--- plugins/bfbc2/bfbc2.cpp | 4 ++-- plugins/bfheroes/bfheroes.cpp | 4 ++-- plugins/blacklight/blacklight.cpp | 4 ++-- plugins/borderlands/borderlands.cpp | 4 ++-- plugins/borderlands2/borderlands2.cpp | 4 ++-- plugins/breach/breach.cpp | 4 ++-- plugins/cod2/cod2.cpp | 4 ++-- plugins/cod4/cod4.cpp | 4 ++-- plugins/cod5/cod5.cpp | 4 ++-- plugins/codmw2/codmw2.cpp | 4 ++-- plugins/codmw2so/codmw2so.cpp | 4 ++-- plugins/cs/cs.cpp | 4 ++-- plugins/dys/dys.cpp | 4 ++-- plugins/etqw/etqw.cpp | 4 ++-- plugins/ffxiv/ffxiv.cpp | 4 ++-- plugins/gmod/gmod.cpp | 4 ++-- plugins/gtaiv/gtaiv.cpp | 4 ++-- plugins/gtasa/gtasa.cpp | 4 ++-- plugins/gtav/gtav.cpp | 6 +++--- plugins/gw/gw.cpp | 4 ++-- plugins/insurgency/insurgency.cpp | 4 ++-- plugins/jc2/jc2.cpp | 4 ++-- plugins/l4d/l4d.cpp | 6 +++--- plugins/l4d2/l4d2.cpp | 6 +++--- plugins/link/link-posix.cpp | 8 ++++---- plugins/link/link.cpp | 20 ++++++++++---------- plugins/lol/lol.cpp | 4 ++-- plugins/lotro/lotro.cpp | 4 ++-- plugins/null_plugin.cpp | 6 +++--- plugins/ql/ql.cpp | 6 +++--- plugins/rl/rl.cpp | 4 ++-- plugins/sr/sr.cpp | 4 ++-- plugins/ut2004/ut2004.cpp | 4 ++-- plugins/ut3/ut3.cpp | 4 ++-- plugins/ut99/ut99.cpp | 4 ++-- plugins/wolfet/wolfet.cpp | 4 ++-- plugins/wow/wow.cpp | 4 ++-- plugins/wow_x64/wow_x64.cpp | 4 ++-- 47 files changed, 111 insertions(+), 111 deletions(-) diff --git a/plugins/aoc/aoc.cpp b/plugins/aoc/aoc.cpp index 7634cd5be..447fdf322 100644 --- a/plugins/aoc/aoc.cpp +++ b/plugins/aoc/aoc.cpp @@ -152,8 +152,8 @@ static MumblePlugin aocplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/arma2/arma2.cpp b/plugins/arma2/arma2.cpp index 9e1bb80fa..b60d2aede 100644 --- a/plugins/arma2/arma2.cpp +++ b/plugins/arma2/arma2.cpp @@ -129,8 +129,8 @@ static MumblePlugin arma2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bf1/bf1.cpp b/plugins/bf1/bf1.cpp index e7426f3b7..b3db7c9fd 100644 --- a/plugins/bf1/bf1.cpp +++ b/plugins/bf1/bf1.cpp @@ -236,8 +236,8 @@ static MumblePlugin bf1plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bf1942/bf1942.cpp b/plugins/bf1942/bf1942.cpp index 3ba7ec9c2..b2b95c876 100644 --- a/plugins/bf1942/bf1942.cpp +++ b/plugins/bf1942/bf1942.cpp @@ -89,8 +89,8 @@ static MumblePlugin bf1942plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bf2/bf2.cpp b/plugins/bf2/bf2.cpp index a0a300933..f9fdfedff 100644 --- a/plugins/bf2/bf2.cpp +++ b/plugins/bf2/bf2.cpp @@ -229,8 +229,8 @@ static MumblePlugin bf2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bf2142/bf2142.cpp b/plugins/bf2142/bf2142.cpp index fbf810783..c763d9d52 100644 --- a/plugins/bf2142/bf2142.cpp +++ b/plugins/bf2142/bf2142.cpp @@ -154,8 +154,8 @@ static MumblePlugin bf2142plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bf3/bf3.cpp b/plugins/bf3/bf3.cpp index 7a56c625c..8ebf3b6bc 100644 --- a/plugins/bf3/bf3.cpp +++ b/plugins/bf3/bf3.cpp @@ -233,8 +233,8 @@ static MumblePlugin bf3plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bf4/bf4.cpp b/plugins/bf4/bf4.cpp index e4d211e23..6cbec31d2 100644 --- a/plugins/bf4/bf4.cpp +++ b/plugins/bf4/bf4.cpp @@ -73,7 +73,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa oidentity << "{"; escape(host, sizeof(host)); // Only include host (IP:port) if it is not empty and does not include the string "bot" (which means it's a local server). - if (strcmp(host, "") != 0 && strstr(host, "bot") == NULL) { + if (strcmp(host, "") != 0 && !strstr(host, "bot")) { oidentity << std::endl << "\"Host\": \"" << host << "\","; } @@ -216,8 +216,8 @@ static MumblePlugin bf4plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bf4_x86/bf4_x86.cpp b/plugins/bf4_x86/bf4_x86.cpp index f6e135719..e6b8465c5 100644 --- a/plugins/bf4_x86/bf4_x86.cpp +++ b/plugins/bf4_x86/bf4_x86.cpp @@ -71,7 +71,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa oidentity << "{"; escape(host, sizeof(host)); // Only include host (IP:port) if it is not empty and does not include the string "bot" (which means it's a local server). - if (strcmp(host, "") != 0 && strstr(host, "bot") == NULL) { + if (strcmp(host, "") != 0 && !strstr(host, "bot")) { oidentity << std::endl << "\"Host\": \"" << host << "\","; } @@ -214,8 +214,8 @@ static MumblePlugin bf4plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bfbc2/bfbc2.cpp b/plugins/bfbc2/bfbc2.cpp index 0d9b8e87d..13cc9fb06 100644 --- a/plugins/bfbc2/bfbc2.cpp +++ b/plugins/bfbc2/bfbc2.cpp @@ -100,8 +100,8 @@ static MumblePlugin bfbc2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/bfheroes/bfheroes.cpp b/plugins/bfheroes/bfheroes.cpp index bd0b80fec..f7fedd376 100644 --- a/plugins/bfheroes/bfheroes.cpp +++ b/plugins/bfheroes/bfheroes.cpp @@ -86,8 +86,8 @@ static MumblePlugin bfheroesplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/blacklight/blacklight.cpp b/plugins/blacklight/blacklight.cpp index 965eee0f8..338f4f300 100644 --- a/plugins/blacklight/blacklight.cpp +++ b/plugins/blacklight/blacklight.cpp @@ -163,8 +163,8 @@ static MumblePlugin blacklightplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/borderlands/borderlands.cpp b/plugins/borderlands/borderlands.cpp index 8bcf641d8..8e80601ae 100644 --- a/plugins/borderlands/borderlands.cpp +++ b/plugins/borderlands/borderlands.cpp @@ -197,8 +197,8 @@ static MumblePlugin borderlandsplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/borderlands2/borderlands2.cpp b/plugins/borderlands2/borderlands2.cpp index f69439a65..304a2ca7a 100644 --- a/plugins/borderlands2/borderlands2.cpp +++ b/plugins/borderlands2/borderlands2.cpp @@ -211,8 +211,8 @@ static MumblePlugin bl2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/breach/breach.cpp b/plugins/breach/breach.cpp index ec121991d..237820e1a 100644 --- a/plugins/breach/breach.cpp +++ b/plugins/breach/breach.cpp @@ -124,8 +124,8 @@ static MumblePlugin breachplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/cod2/cod2.cpp b/plugins/cod2/cod2.cpp index b319e207f..468cf4816 100644 --- a/plugins/cod2/cod2.cpp +++ b/plugins/cod2/cod2.cpp @@ -112,8 +112,8 @@ static MumblePlugin cod2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/cod4/cod4.cpp b/plugins/cod4/cod4.cpp index 548285177..e561f161a 100644 --- a/plugins/cod4/cod4.cpp +++ b/plugins/cod4/cod4.cpp @@ -142,8 +142,8 @@ static MumblePlugin cod4plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/cod5/cod5.cpp b/plugins/cod5/cod5.cpp index 864486f38..7542425a1 100644 --- a/plugins/cod5/cod5.cpp +++ b/plugins/cod5/cod5.cpp @@ -127,8 +127,8 @@ static MumblePlugin cod5plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/codmw2/codmw2.cpp b/plugins/codmw2/codmw2.cpp index 88f8e46a4..8d61a044a 100644 --- a/plugins/codmw2/codmw2.cpp +++ b/plugins/codmw2/codmw2.cpp @@ -127,8 +127,8 @@ static MumblePlugin codmw2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/codmw2so/codmw2so.cpp b/plugins/codmw2so/codmw2so.cpp index 324a66f5e..0e15cf2c1 100644 --- a/plugins/codmw2so/codmw2so.cpp +++ b/plugins/codmw2so/codmw2so.cpp @@ -170,8 +170,8 @@ static MumblePlugin codmw2soplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/cs/cs.cpp b/plugins/cs/cs.cpp index 01f729921..8d1156e84 100644 --- a/plugins/cs/cs.cpp +++ b/plugins/cs/cs.cpp @@ -170,8 +170,8 @@ static MumblePlugin csplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/dys/dys.cpp b/plugins/dys/dys.cpp index 2840a792e..6fee1e606 100644 --- a/plugins/dys/dys.cpp +++ b/plugins/dys/dys.cpp @@ -150,8 +150,8 @@ static MumblePlugin dysplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/etqw/etqw.cpp b/plugins/etqw/etqw.cpp index fe15910ca..6487db650 100644 --- a/plugins/etqw/etqw.cpp +++ b/plugins/etqw/etqw.cpp @@ -133,8 +133,8 @@ static MumblePlugin etqwplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/ffxiv/ffxiv.cpp b/plugins/ffxiv/ffxiv.cpp index 2bd0201ab..579010adf 100755 --- a/plugins/ffxiv/ffxiv.cpp +++ b/plugins/ffxiv/ffxiv.cpp @@ -206,8 +206,8 @@ static MumblePlugin ffxivplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/gmod/gmod.cpp b/plugins/gmod/gmod.cpp index 4ba0027fe..a2d4fa650 100644 --- a/plugins/gmod/gmod.cpp +++ b/plugins/gmod/gmod.cpp @@ -149,8 +149,8 @@ static MumblePlugin gmodplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/gtaiv/gtaiv.cpp b/plugins/gtaiv/gtaiv.cpp index 10b09e0b8..a9918214c 100644 --- a/plugins/gtaiv/gtaiv.cpp +++ b/plugins/gtaiv/gtaiv.cpp @@ -163,8 +163,8 @@ static MumblePlugin gtaivplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/gtasa/gtasa.cpp b/plugins/gtasa/gtasa.cpp index a036e3220..cc0879c64 100644 --- a/plugins/gtasa/gtasa.cpp +++ b/plugins/gtasa/gtasa.cpp @@ -93,8 +93,8 @@ static MumblePlugin gtasaPlug = { MUMBLE_PLUGIN_MAGIC, description, shortName, - NULL, - NULL, + nullptr, + nullptr, tryLock1, generic_unlock, longDesc, diff --git a/plugins/gtav/gtav.cpp b/plugins/gtav/gtav.cpp index ef5178799..f3ddadd98 100644 --- a/plugins/gtav/gtav.cpp +++ b/plugins/gtav/gtav.cpp @@ -97,7 +97,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa // Host escape(host); - if (strcmp(host, "") != 0 && strstr(host, "127.0.0.1") == NULL) { // Set host string as empty if "127.0.0.1" is found in it. + if (strcmp(host, "") != 0 && !strstr(host, "127.0.0.1")) { // Set host string as empty if "127.0.0.1" is found in it. ocontext << " {\"Host\": \"" << host << "\"}"; // Set context with IP address and port } @@ -215,8 +215,8 @@ static MumblePlugin gtavplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/gw/gw.cpp b/plugins/gw/gw.cpp index 6618912da..84b131a66 100644 --- a/plugins/gw/gw.cpp +++ b/plugins/gw/gw.cpp @@ -207,8 +207,8 @@ static MumblePlugin gwplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/insurgency/insurgency.cpp b/plugins/insurgency/insurgency.cpp index 6d2f99fd9..6f8d5067a 100644 --- a/plugins/insurgency/insurgency.cpp +++ b/plugins/insurgency/insurgency.cpp @@ -150,8 +150,8 @@ static MumblePlugin insurgencyplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/jc2/jc2.cpp b/plugins/jc2/jc2.cpp index 0a3a79c8e..e7d2a9550 100755 --- a/plugins/jc2/jc2.cpp +++ b/plugins/jc2/jc2.cpp @@ -164,8 +164,8 @@ static MumblePlugin jc2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/l4d/l4d.cpp b/plugins/l4d/l4d.cpp index 8252d6ea1..d4acec970 100644 --- a/plugins/l4d/l4d.cpp +++ b/plugins/l4d/l4d.cpp @@ -74,7 +74,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa oidentity << "{"; // Host - if (strcmp(host, "") != 0 && strstr(host, "loopback") == NULL) { // Only include host (IP:Port) if it is not empty and does not include the string "loopback" (which means it's a local server). + if (strcmp(host, "") != 0 && !strstr(host, "loopback")) { // Only include host (IP:Port) if it is not empty and does not include the string "loopback" (which means it's a local server). oidentity << std::endl << "\"Host\": \"" << host << "\","; // Set host address in identity. } else { oidentity << std::endl << "\"Host\": null,"; @@ -179,8 +179,8 @@ static MumblePlugin l4dplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/l4d2/l4d2.cpp b/plugins/l4d2/l4d2.cpp index cb6f9f11c..a559ba0c8 100644 --- a/plugins/l4d2/l4d2.cpp +++ b/plugins/l4d2/l4d2.cpp @@ -110,7 +110,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa // Host escape(host, sizeof(host)); - if (strcmp(host, "") != 0 && strstr(host, "loopback") == NULL) { // Only include host (IP:Port) if it is not empty and does not include the string "loopback" (which means it's a local server). + if (strcmp(host, "") != 0 && !strstr(host, "loopback")) { // Only include host (IP:Port) if it is not empty and does not include the string "loopback" (which means it's a local server). oidentity << std::endl << "\"Host\": \"" << host << "\","; // Set host address in identity. } else { oidentity << std::endl << "\"Host\": null,"; @@ -237,8 +237,8 @@ static MumblePlugin l4d2plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/link/link-posix.cpp b/plugins/link/link-posix.cpp index fde39a435..9963f5e92 100644 --- a/plugins/link/link-posix.cpp +++ b/plugins/link/link-posix.cpp @@ -41,7 +41,7 @@ struct LinkedMem { /// Non-monotonic tick count in ms resolution static int64_t GetTickCount() { struct timeval tv; - gettimeofday(&tv,NULL); + gettimeofday(&tv,nullptr); return tv.tv_usec / 1000 + tv.tv_sec * 1000; } @@ -164,7 +164,7 @@ static void load_plugin() { } lm = static_cast( - mmap(NULL, sizeof(struct LinkedMem), PROT_READ | PROT_WRITE, MAP_SHARED, shmfd,0)); + mmap(nullptr, sizeof(struct LinkedMem), PROT_READ | PROT_WRITE, MAP_SHARED, shmfd,0)); if ((lm != lm_invalid) && bCreated) memset(lm, 0, sizeof(struct LinkedMem)); @@ -187,8 +187,8 @@ static MumblePlugin linkplug = { MUMBLE_PLUGIN_MAGIC, description, wsPluginName, - NULL, - NULL, + nullptr, + nullptr, trylock, unlock, longdesc, diff --git a/plugins/link/link.cpp b/plugins/link/link.cpp index aec38b51e..098d84510 100644 --- a/plugins/link/link.cpp +++ b/plugins/link/link.cpp @@ -35,8 +35,8 @@ static void about(void *h) { ::MessageBox(reinterpret_cast(h), L"Reads audio position information from linked game", L"Mumble Link Plugin", MB_OK); } -static HANDLE hMapObject = NULL; -static LinkedMem *lm = NULL; +static HANDLE hMapObject = nullptr; +static LinkedMem *lm = nullptr; static DWORD last_count = 0; static DWORD last_tick = 0; @@ -131,16 +131,16 @@ BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID) { case DLL_PROCESS_ATTACH: wsPluginName.assign(L"Link"); hMapObject = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink"); - if (hMapObject == NULL) { - hMapObject = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(LinkedMem), L"MumbleLink"); + if (!hMapObject) { + hMapObject = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, sizeof(LinkedMem), L"MumbleLink"); bCreated = true; - if (hMapObject == NULL) + if (!hMapObject) return false; } lm = static_cast(MapViewOfFile(hMapObject, FILE_MAP_ALL_ACCESS, 0, 0, 0)); - if (lm == NULL) { + if (!lm) { CloseHandle(hMapObject); - hMapObject = NULL; + hMapObject = nullptr; return false; } if (bCreated) @@ -149,11 +149,11 @@ BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID) { case DLL_PROCESS_DETACH: if (lm) { UnmapViewOfFile(lm); - lm = NULL; + lm = nullptr; } if (hMapObject) { CloseHandle(hMapObject); - hMapObject = NULL; + hMapObject = nullptr; } break; } @@ -167,7 +167,7 @@ static MumblePlugin linkplug = { description, wsPluginName, about, - NULL, + nullptr, trylock, unlock, getdesc, diff --git a/plugins/lol/lol.cpp b/plugins/lol/lol.cpp index 2bc72107f..ef777b551 100644 --- a/plugins/lol/lol.cpp +++ b/plugins/lol/lol.cpp @@ -183,8 +183,8 @@ static MumblePlugin lolplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/lotro/lotro.cpp b/plugins/lotro/lotro.cpp index 41b1be6d5..a8cc1e5f9 100644 --- a/plugins/lotro/lotro.cpp +++ b/plugins/lotro/lotro.cpp @@ -157,8 +157,8 @@ static MumblePlugin lotroplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/null_plugin.cpp b/plugins/null_plugin.cpp index e64ec4b5c..51a02078f 100644 --- a/plugins/null_plugin.cpp +++ b/plugins/null_plugin.cpp @@ -30,10 +30,10 @@ static MumblePlugin nullplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock, - NULL, + nullptr, longdesc, fetch }; diff --git a/plugins/ql/ql.cpp b/plugins/ql/ql.cpp index 42733bc5c..0fd7d0ed8 100644 --- a/plugins/ql/ql.cpp +++ b/plugins/ql/ql.cpp @@ -60,7 +60,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa escape(host, sizeof(host)); std::ostringstream ocontext; ocontext << " {"; - if (strcmp(host, "") != 0 && strstr(host, "loopback") == NULL) { // Only include host (IP:Port) if it is not empty and does not include the string "loopback" (which means it's a local server). + if (strcmp(host, "") != 0 && !strstr(host, "loopback")) { // Only include host (IP:Port) if it is not empty and does not include the string "loopback" (which means it's a local server). ocontext << "\"Host\": \"" << host << "\""; // Set host address in identity. } else { ocontext << "\"Host\": null"; @@ -168,8 +168,8 @@ static MumblePlugin qlplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/rl/rl.cpp b/plugins/rl/rl.cpp index 6f28bdc23..163046b72 100644 --- a/plugins/rl/rl.cpp +++ b/plugins/rl/rl.cpp @@ -110,8 +110,8 @@ static MumblePlugin rlplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/sr/sr.cpp b/plugins/sr/sr.cpp index 05247aa57..a5f9a14d4 100644 --- a/plugins/sr/sr.cpp +++ b/plugins/sr/sr.cpp @@ -126,8 +126,8 @@ static MumblePlugin subrosaplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/ut2004/ut2004.cpp b/plugins/ut2004/ut2004.cpp index 766d79005..33ea5bd23 100644 --- a/plugins/ut2004/ut2004.cpp +++ b/plugins/ut2004/ut2004.cpp @@ -107,8 +107,8 @@ static MumblePlugin ut2004plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/ut3/ut3.cpp b/plugins/ut3/ut3.cpp index ec032bfe6..6931b8438 100644 --- a/plugins/ut3/ut3.cpp +++ b/plugins/ut3/ut3.cpp @@ -128,8 +128,8 @@ static MumblePlugin ut3plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/ut99/ut99.cpp b/plugins/ut99/ut99.cpp index ae71f0d4d..df39aa9e0 100644 --- a/plugins/ut99/ut99.cpp +++ b/plugins/ut99/ut99.cpp @@ -204,8 +204,8 @@ static MumblePlugin ut99plug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/wolfet/wolfet.cpp b/plugins/wolfet/wolfet.cpp index 3d9383913..59f6d34b7 100644 --- a/plugins/wolfet/wolfet.cpp +++ b/plugins/wolfet/wolfet.cpp @@ -132,8 +132,8 @@ static MumblePlugin wolfetplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/wow/wow.cpp b/plugins/wow/wow.cpp index cf969c70a..31941a280 100644 --- a/plugins/wow/wow.cpp +++ b/plugins/wow/wow.cpp @@ -165,8 +165,8 @@ static MumblePlugin wowplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc, diff --git a/plugins/wow_x64/wow_x64.cpp b/plugins/wow_x64/wow_x64.cpp index 98158d5d1..fd0773ec9 100644 --- a/plugins/wow_x64/wow_x64.cpp +++ b/plugins/wow_x64/wow_x64.cpp @@ -165,8 +165,8 @@ static MumblePlugin wowplug = { MUMBLE_PLUGIN_MAGIC, description, shortname, - NULL, - NULL, + nullptr, + nullptr, trylock1, generic_unlock, longdesc,