Merge pull request #4321: REFAC(overlay,plugins): replace NULL with nullptr

This changes all occurances of NULL in the plugins and overlay source dir to nullptr. Additionally explicit comparisons with NULL were removed.

Implements #3763 (partly)
This commit is contained in:
Robert Adam 2020-06-30 07:26:34 +02:00 committed by GitHub
commit 2c57727445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 348 additions and 350 deletions

View File

@ -97,40 +97,40 @@ void D11StateBlock::ReleaseObjects()
{
if (pRasterizerState) {
pRasterizerState->Release();
pRasterizerState = NULL;
pRasterizerState = nullptr;
}
for (int i=0; i<D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
if (pRenderTargetViews[i]) {
pRenderTargetViews[i]->Release();
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; i<D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; i++)
if (pVertexBuffers[i]) {
pVertexBuffers[i]->Release();
pVertexBuffers[i] = NULL;
pVertexBuffers[i] = nullptr;
}
}

View File

@ -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;
}
/**

View File

@ -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;
}

View File

@ -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;

View File

@ -8,7 +8,7 @@
#include <d3d10.h>
#include <time.h>
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<LPCTSTR>(&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<D3D10CreateDeviceAndSwapChainType>(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!");

View File

@ -42,7 +42,7 @@
#include <d3d11.h>
#include <time.h>
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<LPCTSTR>(&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<D3D11CreateDeviceAndSwapChainType>(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!");

View File

@ -7,7 +7,7 @@
#include <d3d9.h>
#include <time.h>
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<voidFunc>(myReset));
hhPresent.setupInterface(idd, offsetPresent, reinterpret_cast<voidFunc>(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<voidFunc>(myPresent));
hhPresentEx.setupInterface(idd, offsetPresentEx, reinterpret_cast<voidFunc>(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<LPCTSTR>(&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<voidFunc>(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;

View File

@ -38,7 +38,7 @@
#include "lib.h"
#include <dxgi.h>
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<LPCTSTR>(&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<CreateDXGIFactory1Type>(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.

View File

@ -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<unsigned char *>(omMsg.headerbuffer) + dwAlreadyRead, sizeof(OverlayMsgHeader) - dwAlreadyRead, &dwBytesRead, NULL)) {
if (! ReadFile(hSocket, reinterpret_cast<unsigned char *>(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<unsigned char *>(omMsg.msgbuffer) + dwAlreadyRead, omMsg.omh.iLength - dwAlreadyRead, &dwBytesRead, NULL)) {
if (! ReadFile(hSocket, reinterpret_cast<unsigned char *>(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<unsigned char *>(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<LPCTSTR>(&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<void *>(parent), 0, NULL);
HANDLE pcheckHandle = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE) OverlayHelperProcessParentDeathThread,
reinterpret_cast<void *>(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<unsigned char *>(
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<size_t> 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<LPCTSTR>(fnptr), &hModule)) {
ods((logPrefix + ": Failed to get module for " + fnName).c_str());

View File

@ -21,7 +21,7 @@
static std::vector<std::string> defaultBlacklistVector() {
std::vector<std::string> 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<std::string> defaultBlacklistVector() {
static std::vector<std::string> defaultWhitelistVector() {
std::vector<std::string> 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<std::string> defaultWhitelistVector() {
static std::vector<std::string> defaultLaunchersVector() {
std::vector<std::string> 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<std::string> regReadMultiString(HKEY key,
{
LONG err = 0;
std::vector<std::string> 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<std::string> regReadMultiString(HKEY key,
}
buf = reinterpret_cast<char *>(malloc(sz));
if (buf == NULL) {
if (!buf) {
goto err;
}
err = RegQueryValueExA(subKeyHandle, valueName.c_str(), NULL, &type, reinterpret_cast<BYTE *>(buf), &sz);
err = RegQueryValueExA(subKeyHandle, valueName.c_str(), nullptr, &type, reinterpret_cast<BYTE *>(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<BYTE *>(&mode), &sz);
err = RegQueryValueExA(key, "mode", nullptr, nullptr, reinterpret_cast<BYTE *>(&mode), &sz);
if (err != ERROR_SUCCESS) {
return -1;
}

View File

@ -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<t##name>(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<LPCTSTR>(&checkOpenGLHook), &hTempSelf);
#define INJECT(handle, name) {\

View File

@ -64,7 +64,7 @@ static const char *overlayBlacklist[] = {
"mspub.exe", // Publisher
"msaccess.exe", // Access
NULL
nullptr
};
#endif

View File

@ -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<std::wstring> GetCommandLineArgs() {
std::vector<std::wstring> 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);
}

View File

@ -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

View File

@ -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

View File

@ -11,7 +11,7 @@ static const char *overlayWhitelist[] = {
"gw2.exe",
"gw2-64.exe",
NULL
nullptr
};
#endif

View File

@ -152,8 +152,8 @@ static MumblePlugin aocplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -129,8 +129,8 @@ static MumblePlugin arma2plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -236,8 +236,8 @@ static MumblePlugin bf1plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -89,8 +89,8 @@ static MumblePlugin bf1942plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -229,8 +229,8 @@ static MumblePlugin bf2plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -154,8 +154,8 @@ static MumblePlugin bf2142plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -233,8 +233,8 @@ static MumblePlugin bf3plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -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,

View File

@ -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,

View File

@ -100,8 +100,8 @@ static MumblePlugin bfbc2plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -86,8 +86,8 @@ static MumblePlugin bfheroesplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -163,8 +163,8 @@ static MumblePlugin blacklightplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -197,8 +197,8 @@ static MumblePlugin borderlandsplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -211,8 +211,8 @@ static MumblePlugin bl2plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -124,8 +124,8 @@ static MumblePlugin breachplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -112,8 +112,8 @@ static MumblePlugin cod2plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -142,8 +142,8 @@ static MumblePlugin cod4plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -127,8 +127,8 @@ static MumblePlugin cod5plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -127,8 +127,8 @@ static MumblePlugin codmw2plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -170,8 +170,8 @@ static MumblePlugin codmw2soplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -170,8 +170,8 @@ static MumblePlugin csplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -150,8 +150,8 @@ static MumblePlugin dysplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -133,8 +133,8 @@ static MumblePlugin etqwplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -206,8 +206,8 @@ static MumblePlugin ffxivplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -149,8 +149,8 @@ static MumblePlugin gmodplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -163,8 +163,8 @@ static MumblePlugin gtaivplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -93,8 +93,8 @@ static MumblePlugin gtasaPlug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortName,
NULL,
NULL,
nullptr,
nullptr,
tryLock1,
generic_unlock,
longDesc,

View File

@ -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,

View File

@ -207,8 +207,8 @@ static MumblePlugin gwplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -150,8 +150,8 @@ static MumblePlugin insurgencyplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -164,8 +164,8 @@ static MumblePlugin jc2plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -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,

View File

@ -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,

View File

@ -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<struct LinkedMem*>(
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,

View File

@ -35,8 +35,8 @@ static void about(void *h) {
::MessageBox(reinterpret_cast<HWND>(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<LinkedMem *>(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,

View File

@ -183,8 +183,8 @@ static MumblePlugin lolplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -157,8 +157,8 @@ static MumblePlugin lotroplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -30,10 +30,10 @@ static MumblePlugin nullplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock,
NULL,
nullptr,
longdesc,
fetch
};

View File

@ -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,

View File

@ -110,8 +110,8 @@ static MumblePlugin rlplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -126,8 +126,8 @@ static MumblePlugin subrosaplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -107,8 +107,8 @@ static MumblePlugin ut2004plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -128,8 +128,8 @@ static MumblePlugin ut3plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -204,8 +204,8 @@ static MumblePlugin ut99plug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -132,8 +132,8 @@ static MumblePlugin wolfetplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -165,8 +165,8 @@ static MumblePlugin wowplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,

View File

@ -165,8 +165,8 @@ static MumblePlugin wowplug = {
MUMBLE_PLUGIN_MAGIC,
description,
shortname,
NULL,
NULL,
nullptr,
nullptr,
trylock1,
generic_unlock,
longdesc,