General: Make use of nullptr where applicable

This commit is contained in:
Lioncash 2019-08-16 03:47:57 -04:00 committed by Phillip Stephens
parent 386ec8e6cc
commit 78ce16aa9f
16 changed files with 77 additions and 75 deletions

View File

@ -18,12 +18,13 @@ class DeviceBase;
struct DeviceSignature {
typedef std::vector<const DeviceSignature*> TDeviceSignatureSet;
typedef std::function<std::shared_ptr<DeviceBase>(DeviceToken*)> TFactoryLambda;
const char* m_name;
uint64_t m_typeHash;
unsigned m_vid, m_pid;
const char* m_name = nullptr;
uint64_t m_typeHash = 0;
unsigned m_vid = 0;
unsigned m_pid = 0;
TFactoryLambda m_factory;
DeviceType m_type;
DeviceSignature() : m_name(NULL), m_typeHash(dev_typeid(DeviceSignature)) {} /* Sentinel constructor */
DeviceType m_type{};
DeviceSignature() : m_typeHash(dev_typeid(DeviceSignature)) {} /* Sentinel constructor */
DeviceSignature(const char* name, uint64_t typeHash, unsigned vid, unsigned pid, TFactoryLambda&& factory,
DeviceType type = DeviceType::None)
: m_name(name), m_typeHash(typeHash), m_vid(vid), m_pid(pid), m_factory(factory), m_type(type) {}

View File

@ -78,11 +78,11 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
CFStringGetCStringPtr(devName, kCFStringEncodingUTF8));
argSize = sizeof(devId);
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &argSize, &devId) == noErr) {
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &argSize, &devId) == noErr) {
argSize = sizeof(CFStringRef);
AudioObjectPropertyAddress deviceAddress;
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
AudioObjectGetPropertyData(devId, &deviceAddress, 0, NULL, &argSize, &m_devName);
AudioObjectGetPropertyData(devId, &deviceAddress, 0, nullptr, &argSize, &m_devName);
} else {
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
return {AudioChannelSet::Unknown, 48000.0};
@ -90,21 +90,21 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
}
propertyAddress.mSelector = kAudioDevicePropertyStreams;
if (AudioObjectGetPropertyDataSize(devId, &propertyAddress, 0, NULL, &argSize) == noErr) {
if (AudioObjectGetPropertyDataSize(devId, &propertyAddress, 0, nullptr, &argSize) == noErr) {
numStreams = argSize / sizeof(AudioStreamID);
streamIDs.resize(numStreams);
if (AudioObjectGetPropertyData(devId, &propertyAddress, 0, NULL, &argSize, &streamIDs[0]) == noErr) {
if (AudioObjectGetPropertyData(devId, &propertyAddress, 0, nullptr, &argSize, &streamIDs[0]) == noErr) {
propertyAddress.mSelector = kAudioStreamPropertyDirection;
for (int stm = 0; stm < numStreams; stm++) {
UInt32 streamDir;
argSize = sizeof(streamDir);
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, NULL, &argSize, &streamDir) == noErr) {
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, nullptr, &argSize, &streamDir) == noErr) {
if (streamDir == 0) {
propertyAddress.mSelector = kAudioStreamPropertyPhysicalFormat;
AudioStreamBasicDescription asbd;
argSize = sizeof(asbd);
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, NULL, &argSize, &asbd) == noErr) {
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, nullptr, &argSize, &asbd) == noErr) {
switch (asbd.mChannelsPerFrame) {
case 2:
return {AudioChannelSet::Stereo, asbd.mSampleRate};
@ -155,29 +155,29 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
propertyAddress.mSelector = kAudioHardwarePropertyDevices;
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &propertySize) == noErr) {
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &propertySize) == noErr) {
numDevices = propertySize / sizeof(AudioDeviceID);
ret.reserve(numDevices);
deviceIDs.resize(numDevices);
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &propertySize,
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &propertySize,
&deviceIDs[0]) == noErr) {
char deviceName[64];
for (int idx = 0; idx < numDevices; idx++) {
propertyAddress.mSelector = kAudioDevicePropertyStreams;
if (AudioObjectGetPropertyDataSize(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize) == noErr) {
if (AudioObjectGetPropertyDataSize(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize) == noErr) {
numStreams = propertySize / sizeof(AudioStreamID);
streamIDs.resize(numStreams);
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize, &streamIDs[0]) ==
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize, &streamIDs[0]) ==
noErr) {
propertyAddress.mSelector = kAudioStreamPropertyDirection;
bool foundOutput = false;
for (int stm = 0; stm < numStreams; stm++) {
UInt32 streamDir;
propertySize = sizeof(streamDir);
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, NULL, &propertySize, &streamDir) ==
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, nullptr, &propertySize, &streamDir) ==
noErr) {
if (streamDir == 0) {
foundOutput = true;
@ -192,13 +192,13 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
propertySize = sizeof(deviceName);
propertyAddress.mSelector = kAudioDevicePropertyDeviceName;
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize, deviceName) ==
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize, deviceName) ==
noErr) {
CFPointer<CFStringRef> uidString;
propertySize = sizeof(CFStringRef);
propertyAddress.mSelector = kAudioDevicePropertyDeviceUID;
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize, &uidString) ==
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize, &uidString) ==
noErr) {
ret.emplace_back(CFStringGetCStringPtr(uidString.get(), kCFStringEncodingUTF8), deviceName);
}
@ -800,11 +800,11 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
const AudioObjectPropertyAddress* inAddresses, AQSAudioVoiceEngine* engine) {
AudioObjectID defaultDeviceId;
UInt32 argSize = sizeof(defaultDeviceId);
if (AudioObjectGetPropertyData(inObjectID, inAddresses, 0, NULL, &argSize, &defaultDeviceId) == noErr) {
if (AudioObjectGetPropertyData(inObjectID, inAddresses, 0, nullptr, &argSize, &defaultDeviceId) == noErr) {
argSize = sizeof(CFStringRef);
AudioObjectPropertyAddress deviceAddress;
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, NULL, &argSize, &engine->m_devName);
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, nullptr, &argSize, &engine->m_devName);
}
engine->m_needsRebuild = true;
return noErr;
@ -820,12 +820,12 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
AudioObjectID defaultDeviceId;
UInt32 argSize = sizeof(defaultDeviceId);
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &argSize, &defaultDeviceId) ==
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &argSize, &defaultDeviceId) ==
noErr) {
argSize = sizeof(CFStringRef);
AudioObjectPropertyAddress deviceAddress;
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, NULL, &argSize, &m_devName);
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, nullptr, &argSize, &m_devName);
} else {
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
return;

View File

@ -38,9 +38,9 @@ namespace boo {
static logvisor::Module Log("boo::WASAPI");
#define SAFE_RELEASE(punk) \
if ((punk) != NULL) { \
if ((punk) != nullptr) { \
(punk)->Release(); \
(punk) = NULL; \
(punk) = nullptr; \
}
struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
@ -90,7 +90,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
AddRef();
*ppvInterface = (IMMNotificationClient*)this;
} else {
*ppvInterface = NULL;
*ppvInterface = nullptr;
return E_NOINTERFACE;
}
return S_OK;
@ -303,7 +303,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
AddRef();
*ppvInterface = (IActivateAudioInterfaceCompletionHandler*)this;
} else {
*ppvInterface = NULL;
*ppvInterface = nullptr;
return E_NOINTERFACE;
}
return S_OK;
@ -663,7 +663,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
m_hdr.dwBufferLength = 512;
m_hdr.dwFlags = MHDR_ISSTRM;
midiOutPrepareHeader(m_midi, &m_hdr, sizeof(m_hdr));
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
midiStreamOpen(&m_strm, &id, 1, 0, 0, CALLBACK_NULL);
}
~MIDIOut() override {
@ -712,7 +712,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
m_hdr.dwBufferLength = 512;
m_hdr.dwFlags = MHDR_ISSTRM;
midiOutPrepareHeader(m_midiOut, &m_hdr, sizeof(m_hdr));
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
midiStreamOpen(&m_strm, &id, 1, 0, 0, CALLBACK_NULL);
}
~MIDIInOut() override {
@ -835,7 +835,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
if (!ret)
return {};
if (FAILED(midiOutOpen(&static_cast<MIDIOut&>(*ret).m_midi, id, NULL, NULL, CALLBACK_NULL)))
if (FAILED(midiOutOpen(&static_cast<MIDIOut&>(*ret).m_midi, id, 0, 0, CALLBACK_NULL)))
return {};
static_cast<MIDIOut&>(*ret).prepare();
@ -861,7 +861,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
return {};
midiInStart(static_cast<MIDIInOut&>(*ret).m_midiIn);
if (FAILED(midiOutOpen(&static_cast<MIDIInOut&>(*ret).m_midiOut, outId, NULL, NULL, CALLBACK_NULL)))
if (FAILED(midiOutOpen(&static_cast<MIDIInOut&>(*ret).m_midiOut, outId, 0, 0, CALLBACK_NULL)))
return {};
static_cast<MIDIInOut&>(*ret).prepare();

View File

@ -188,7 +188,7 @@ static void SetImageLayout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlag
uint32_t layerCount, uint32_t baseMipLevel = 0) {
VkImageMemoryBarrier imageMemoryBarrier = {};
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
imageMemoryBarrier.pNext = NULL;
imageMemoryBarrier.pNext = nullptr;
imageMemoryBarrier.srcAccessMask = 0;
imageMemoryBarrier.dstAccessMask = 0;
imageMemoryBarrier.oldLayout = old_image_layout;
@ -261,7 +261,7 @@ static void SetImageLayout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlag
break;
}
vk::CmdPipelineBarrier(cmd, src_stages, dest_stages, 0, 0, NULL, 0, NULL, 1, &imageMemoryBarrier);
vk::CmdPipelineBarrier(cmd, src_stages, dest_stages, 0, 0, nullptr, 0, nullptr, 1, &imageMemoryBarrier);
}
static VkResult InitGlobalExtensionProperties(VulkanContext::LayerProperties& layerProps) {

View File

@ -1801,7 +1801,7 @@ bool NXContext::initialize() {
gfxInitDefault();
gfxSetMode(GfxMode_TiledDouble);
consoleInit(NULL);
consoleInit(nullptr);
printf("Activated console\n\n");
m_screen = nouveau_switch_screen_create();
if (!m_screen) {

View File

@ -102,7 +102,7 @@ class HIDDeviceUdev final : public IHIDDevice {
}
/* Request that kernel disconnects existing driver */
usbdevfs_ioctl disconnectReq = {0, USBDEVFS_DISCONNECT, NULL};
usbdevfs_ioctl disconnectReq = {0, USBDEVFS_DISCONNECT, nullptr};
ioctl(fd, USBDEVFS_IOCTL, &disconnectReq);
/* Return control to main thread */

View File

@ -27,8 +27,8 @@ class HIDDeviceWinUSB final : public IHIDDevice {
DeviceToken& m_token;
std::shared_ptr<DeviceBase> m_devImp;
HANDLE m_devHandle = 0;
HANDLE m_hidHandle = 0;
HANDLE m_devHandle = nullptr;
HANDLE m_hidHandle = nullptr;
WINUSB_INTERFACE_HANDLE m_usbHandle = nullptr;
unsigned m_usbIntfInPipe = 0;
unsigned m_usbIntfOutPipe = 0;
@ -42,9 +42,10 @@ class HIDDeviceWinUSB final : public IHIDDevice {
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override {
if (m_usbHandle) {
ULONG lengthTransferred = 0;
if (!WinUsb_WritePipe(m_usbHandle, m_usbIntfOutPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, NULL) ||
lengthTransferred != length)
if (!WinUsb_WritePipe(m_usbHandle, m_usbIntfOutPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, nullptr) ||
lengthTransferred != length) {
return false;
}
return true;
}
return false;
@ -53,7 +54,7 @@ class HIDDeviceWinUSB final : public IHIDDevice {
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override {
if (m_usbHandle) {
ULONG lengthTransferred = 0;
if (!WinUsb_ReadPipe(m_usbHandle, m_usbIntfInPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, NULL))
if (!WinUsb_ReadPipe(m_usbHandle, m_usbIntfInPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, nullptr))
return 0;
return lengthTransferred;
}
@ -66,8 +67,8 @@ class HIDDeviceWinUSB final : public IHIDDevice {
/* POSIX.. who needs it?? -MS */
device->m_devHandle =
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr);
if (INVALID_HANDLE_VALUE == device->m_devHandle) {
device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"),
device->m_token.getProductName(), device->m_devPath, GetLastError());
@ -150,8 +151,8 @@ class HIDDeviceWinUSB final : public IHIDDevice {
/* POSIX.. who needs it?? -MS */
device->m_overlapped.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
device->m_hidHandle =
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr);
if (INVALID_HANDLE_VALUE == device->m_hidHandle) {
device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"),
device->m_token.getProductName(), device->m_devPath, GetLastError());

View File

@ -51,17 +51,17 @@ class HIDListenerWinUSB final : public IHIDListener {
CHAR szVid[MAX_DEVICE_ID_LEN], szPid[MAX_DEVICE_ID_LEN], szMi[MAX_DEVICE_ID_LEN];
/* List all connected HID devices */
hDevInfo = SetupDiGetClassDevs(NULL, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES | DIGCF_DEVICEINTERFACE);
hDevInfo = SetupDiGetClassDevs(nullptr, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES | DIGCF_DEVICEINTERFACE);
if (hDevInfo == INVALID_HANDLE_VALUE)
return;
for (i = 0;; ++i) {
if (!SetupDiEnumDeviceInterfaces(hDevInfo, NULL, TypeGUID, i, &DeviceInterfaceData))
if (!SetupDiEnumDeviceInterfaces(hDevInfo, nullptr, TypeGUID, i, &DeviceInterfaceData))
break;
DeviceInterfaceDetailData.wtf.cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
if (!SetupDiGetDeviceInterfaceDetailA(hDevInfo, &DeviceInterfaceData, &DeviceInterfaceDetailData.wtf,
sizeof(DeviceInterfaceDetailData), NULL, &DeviceInfoData))
sizeof(DeviceInterfaceDetailData), nullptr, &DeviceInfoData))
continue;
r = CM_Get_Device_IDA(DeviceInfoData.DevInst, szDeviceInstanceID, MAX_PATH, 0);
@ -73,7 +73,7 @@ class HIDListenerWinUSB final : public IHIDListener {
szVid[0] = '\0';
szPid[0] = '\0';
szMi[0] = '\0';
while (pszToken != NULL) {
while (pszToken != nullptr) {
for (j = 0; j < 3; ++j) {
if (strncmp(pszToken, arPrefix[j], 4) == 0) {
switch (j) {
@ -91,14 +91,14 @@ class HIDListenerWinUSB final : public IHIDListener {
}
}
}
pszToken = strtok_s(NULL, "\\#&", &pszNextToken);
pszToken = strtok_s(nullptr, "\\#&", &pszNextToken);
}
if (!szVid[0] || !szPid[0])
continue;
unsigned vid = strtol(szVid + 4, NULL, 16);
unsigned pid = strtol(szPid + 4, NULL, 16);
unsigned vid = strtol(szVid + 4, nullptr, 16);
unsigned pid = strtol(szPid + 4, nullptr, 16);
CHAR productW[1024] = {0};
// CHAR product[1024] = {0};
@ -121,8 +121,8 @@ class HIDListenerWinUSB final : public IHIDListener {
if (type == DeviceType::HID) {
HANDLE devHnd = CreateFileA(DeviceInterfaceDetailData.wtf.DevicePath, GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr);
if (INVALID_HANDLE_VALUE == devHnd)
continue;
PHIDP_PREPARSED_DATA preparsedData;

View File

@ -93,7 +93,7 @@ static const NSOpenGLPixelFormatAttribute PF_RGBAF32_Z24_ATTRS[] =
static const NSOpenGLPixelFormatAttribute* PF_TABLE[] =
{
NULL,
nullptr,
PF_RGBA8_ATTRS,
PF_RGBA16_ATTRS,
PF_RGBA8_Z24_ATTRS,
@ -330,15 +330,15 @@ IGraphicsContext* _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI api,
GLContext* glCtx)
{
if (api != IGraphicsContext::EGraphicsAPI::OpenGL3_3 && api != IGraphicsContext::EGraphicsAPI::OpenGL4_2)
return NULL;
return nullptr;
/* Create temporary context to query GL version */
NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_RGBA8_ATTRS];
if (!nspf)
return NULL;
return nullptr;
NSOpenGLContext* nsctx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:nil];
if (!nsctx)
return NULL;
return nullptr;
[nsctx makeCurrentContext];
const char* glVersion = (char*)glGetString(GL_VERSION);
unsigned major = 0;
@ -352,13 +352,13 @@ IGraphicsContext* _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI api,
Log.report(logvisor::Fatal, fmt("glewInit failed"));
[NSOpenGLContext clearCurrentContext];
if (!glVersion)
return NULL;
return nullptr;
if (major > 4 || (major == 4 && minor >= 2))
api = IGraphicsContext::EGraphicsAPI::OpenGL4_2;
else if (major == 3 && minor >= 3)
if (api == IGraphicsContext::EGraphicsAPI::OpenGL4_2)
return NULL;
return nullptr;
return new GraphicsContextCocoaGL(api, parentWindow, lastGLCtx, glCtx);
}

View File

@ -222,7 +222,7 @@ public:
void _setWindow(CoreWindow ^ window) { m_window = _WindowUWPNew(m_friendlyName, m_3dCtx); }
};
IApplication* APP = NULL;
IApplication* APP = nullptr;
ref class AppView sealed : public IFrameworkView {
ApplicationUWP m_app;

View File

@ -340,7 +340,7 @@ public:
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(monitor_info);
GetMonitorInfo(MonitorFromWindow(win.m_hwnd, MONITOR_DEFAULTTONEAREST), &monitor_info);
SetWindowPos(win.m_hwnd, NULL, monitor_info.rcMonitor.left, monitor_info.rcMonitor.top,
SetWindowPos(win.m_hwnd, nullptr, monitor_info.rcMonitor.left, monitor_info.rcMonitor.top,
monitor_info.rcMonitor.right - monitor_info.rcMonitor.left,
monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
@ -350,7 +350,7 @@ public:
SetWindowLong(win.m_hwnd, GWL_STYLE, win.m_fsStyle);
SetWindowLong(win.m_hwnd, GWL_EXSTYLE, win.m_fsExStyle);
SetWindowPos(win.m_hwnd, NULL, win.m_fsRect.left, win.m_fsRect.top, win.m_fsRect.right - win.m_fsRect.left,
SetWindowPos(win.m_hwnd, nullptr, win.m_fsRect.left, win.m_fsRect.top, win.m_fsRect.right - win.m_fsRect.left,
win.m_fsRect.bottom - win.m_fsRect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
win.m_fs = false;
@ -372,8 +372,8 @@ public:
});
/* Pump messages */
MSG msg = {0};
while (GetMessage(&msg, NULL, 0, 0)) {
MSG msg = {};
while (GetMessage(&msg, nullptr, 0, 0)) {
if (!msg.hwnd) {
/* PostThreadMessage events */
switch (msg.message) {
@ -457,7 +457,7 @@ public:
}
};
IApplication* APP = NULL;
IApplication* APP = nullptr;
int ApplicationRun(IApplication::EPlatformType platform, IApplicationCallback& cb, SystemStringView uniqueName,
SystemStringView friendlyName, SystemStringView pname, const std::vector<SystemString>& args,
std::string_view gfxApi, uint32_t samples, uint32_t anisotropy, bool deepColor,
@ -484,7 +484,7 @@ int ApplicationRun(IApplication::EPlatformType platform, IApplicationCallback& c
WIN32_CURSORS.m_wait = LoadCursor(nullptr, IDC_WAIT);
/* One class for *all* boo windows */
WNDCLASS wndClass = {0, WindowProc, 0, 0, GetModuleHandle(nullptr), 0, 0, 0, 0, L"BooWindow"};
WNDCLASS wndClass = {0, WindowProc, 0, 0, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"BooWindow"};
wndClass.hIcon = LoadIconW(wndClass.hInstance, MAKEINTRESOURCEW(101));
wndClass.hCursor = WIN32_CURSORS.m_arrow;
RegisterClassW(&wndClass);

View File

@ -26,7 +26,7 @@ extern PFN_GetScaleFactorForMonitor MyGetScaleFactorForMonitor;
struct OGLContext {
ComPtr<IDXGIFactory1> m_dxFactory;
HGLRC m_lastContext = 0;
HGLRC m_lastContext = nullptr;
struct Window {
HWND m_hwnd;
HDC m_deviceContext;

View File

@ -198,7 +198,7 @@ public:
Log.report(logvisor::Fatal, fmt("glewInit failed"));
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
wglMakeCurrent(w.m_deviceContext, 0);
wglMakeCurrent(w.m_deviceContext, nullptr);
wglDeleteContext(tmpCtx);
if (b3dCtx.m_ctxOgl.m_glCtx.m_deepColor) {
@ -303,7 +303,7 @@ public:
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
/* Creates a new context on current thread!! Call from client loading thread */
HGLRC m_mainCtx = 0;
HGLRC m_mainCtx = nullptr;
IGraphicsDataFactory* getMainContextDataFactory() override {
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
if (!m_mainCtx) {
@ -317,7 +317,7 @@ public:
}
/* Creates a new context on current thread!! Call from client loading thread */
HGLRC m_loadCtx = 0;
HGLRC m_loadCtx = nullptr;
IGraphicsDataFactory* getLoadContextDataFactory() override {
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
if (!m_loadCtx) {
@ -852,7 +852,7 @@ public:
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
m_hwnd = CreateWindowW(L"BooWindow", title.data(), WS_OVERLAPPEDWINDOW, r.left, r.top, r.right - r.left,
r.bottom - r.top, NULL, NULL, NULL, NULL);
r.bottom - r.top, nullptr, nullptr, nullptr, nullptr);
HINSTANCE wndInstance = HINSTANCE(GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE));
m_imc = ImmGetContext(m_hwnd);

View File

@ -99,8 +99,8 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst) {
fmt::print(stderr, fmt("DBus Connection Error ({})\n"), err.message);
dbus_error_free(&err);
}
if (NULL == conn)
return NULL;
if (conn == nullptr)
return nullptr;
/* request our name on the bus and check for errors */
int ret = dbus_bus_request_name(conn, fmt::format(fmt("boo.{}.unique"), appName).c_str(),
@ -109,7 +109,7 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst) {
fmt::print(stderr, fmt("DBus Name Error ({})\n"), err.message);
dbus_error_free(&err);
dbus_connection_close(conn);
return NULL;
return nullptr;
}
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
isFirst = false;

View File

@ -459,7 +459,7 @@ public:
FD_ZERO(&fds);
FD_SET(m_x11Fd, &fds);
FD_SET(m_dbusFd, &fds);
if (pselect(m_maxFd + 1, &fds, NULL, NULL, NULL, &origmask) < 0) {
if (pselect(m_maxFd + 1, &fds, nullptr, nullptr, nullptr, &origmask) < 0) {
/* SIGINT/SIGUSR2 handled here */
if (errno == EINTR)
break;

View File

@ -227,7 +227,7 @@ struct XlibAtoms {
m_imagePng = XInternAtom(disp, "image/png", false);
}
};
static XlibAtoms* S_ATOMS = NULL;
static XlibAtoms* S_ATOMS = nullptr;
static Atom GetClipboardTypeAtom(EClipboardType t) {
switch (t) {