diff options
| author | Tillmann Karras <tilkax@gmail.com> | 2014-03-09 21:14:26 +0100 |
|---|---|---|
| committer | Tillmann Karras <tilkax@gmail.com> | 2014-03-09 21:14:26 +0100 |
| commit | d802d392811be44d34ae9cd23f616db93e54c50f (patch) | |
| tree | f9aa8831a0731ea246bd921d979f4bffa7f07bd0 /Source/Core/InputCommon | |
| parent | f28116b7da6aac6069084596dc4dbf866bdebfd8 (diff) | |
clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
Diffstat (limited to 'Source/Core/InputCommon')
19 files changed, 75 insertions, 75 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 7153a8d7f7..a2534b56a1 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -230,7 +230,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* , const DeviceQualifier& default_device) const { delete ref->parsed_expression; - ref->parsed_expression = NULL; + ref->parsed_expression = nullptr; ControlFinder finder(*this, default_device, ref->is_input); ref->parse_error = ParseExpression(ref->expression, finder, &ref->parsed_expression); @@ -244,7 +244,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* // which is useful for those crazy flightsticks that have certain buttons that are always held down // or some crazy axes or something // upon input, return pointer to detected Control -// else return NULL +// else return nullptr // Device::Control* ControllerInterface::InputReference::Detect(const unsigned int ms, Device* const device) { @@ -252,7 +252,7 @@ Device::Control* ControllerInterface::InputReference::Detect(const unsigned int std::vector<bool> states(device->Inputs().size()); if (device->Inputs().size() == 0) - return NULL; + return nullptr; // get starting state of all inputs, // so we can ignore those that were activated at time of Detect start @@ -285,7 +285,7 @@ Device::Control* ControllerInterface::InputReference::Detect(const unsigned int } // no input was detected - return NULL; + return nullptr; } // @@ -317,5 +317,5 @@ Device::Control* ControllerInterface::OutputReference::Detect(const unsigned int State(0); device->UpdateOutput(); } - return NULL; + return nullptr; } diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 898fd954fb..763933aa22 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -83,7 +83,7 @@ public: } protected: - ControlReference(const bool _is_input) : range(1), is_input(_is_input), parsed_expression(NULL) {} + ControlReference(const bool _is_input) : range(1), is_input(_is_input), parsed_expression(nullptr) {} ciface::ExpressionParser::Expression *parsed_expression; }; @@ -113,7 +113,7 @@ public: Device::Control* Detect(const unsigned int ms, Device* const device) override; }; - ControllerInterface() : m_is_init(false), m_hwnd(NULL) {} + ControllerInterface() : m_is_init(false), m_hwnd(nullptr) {} void SetHwnd(void* const hwnd); void Initialize(); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp index f2d2460ee6..48b5884312 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp @@ -48,7 +48,7 @@ std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device) void Init(std::vector<Core::Device*>& devices, HWND hwnd) { IDirectInput8* idi8; - if (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&idi8, NULL))) + if (FAILED(DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&idi8, nullptr))) return; InitKeyboardMouse(idi8, devices, hwnd); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index e98c13df88..75b21c0e8c 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -24,47 +24,47 @@ namespace DInput void GetXInputGUIDS( std::vector<DWORD>& guids ) { -#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } - IWbemLocator* pIWbemLocator = NULL; - IEnumWbemClassObject* pEnumDevices = NULL; + IWbemLocator* pIWbemLocator = nullptr; + IEnumWbemClassObject* pEnumDevices = nullptr; IWbemClassObject* pDevices[20] = {0}; - IWbemServices* pIWbemServices = NULL; - BSTR bstrNamespace = NULL; - BSTR bstrDeviceID = NULL; - BSTR bstrClassName = NULL; + IWbemServices* pIWbemServices = nullptr; + BSTR bstrNamespace = nullptr; + BSTR bstrDeviceID = nullptr; + BSTR bstrClassName = nullptr; DWORD uReturned = 0; VARIANT var; HRESULT hr; // CoInit if needed - hr = CoInitialize(NULL); + hr = CoInitialize(nullptr); bool bCleanupCOM = SUCCEEDED(hr); // Create WMI hr = CoCreateInstance(__uuidof(WbemLocator), - NULL, + nullptr, CLSCTX_INPROC_SERVER, __uuidof(IWbemLocator), (LPVOID*) &pIWbemLocator); - if (FAILED(hr) || pIWbemLocator == NULL) + if (FAILED(hr) || pIWbemLocator == nullptr) goto LCleanup; - bstrNamespace = SysAllocString(L"\\\\.\\root\\cimv2");if(bstrNamespace == NULL) goto LCleanup; - bstrClassName = SysAllocString(L"Win32_PNPEntity"); if(bstrClassName == NULL) goto LCleanup; - bstrDeviceID = SysAllocString(L"DeviceID"); if(bstrDeviceID == NULL) goto LCleanup; + bstrNamespace = SysAllocString(L"\\\\.\\root\\cimv2");if(bstrNamespace == nullptr) goto LCleanup; + bstrClassName = SysAllocString(L"Win32_PNPEntity"); if(bstrClassName == nullptr) goto LCleanup; + bstrDeviceID = SysAllocString(L"DeviceID"); if(bstrDeviceID == nullptr) goto LCleanup; // Connect to WMI - hr = pIWbemLocator->ConnectServer(bstrNamespace, NULL, NULL, 0L, 0L, NULL, NULL, &pIWbemServices); - if (FAILED(hr) || pIWbemServices == NULL) + hr = pIWbemLocator->ConnectServer(bstrNamespace, nullptr, nullptr, 0L, 0L, nullptr, nullptr, &pIWbemServices); + if (FAILED(hr) || pIWbemServices == nullptr) goto LCleanup; // Switch security level to IMPERSONATE. - CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, - RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); + CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr, + RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE); - hr = pIWbemServices->CreateInstanceEnum(bstrClassName, 0, NULL, &pEnumDevices); - if (FAILED(hr) || pEnumDevices == NULL) + hr = pIWbemServices->CreateInstanceEnum(bstrClassName, 0, nullptr, &pEnumDevices); + if (FAILED(hr) || pEnumDevices == nullptr) goto LCleanup; // Loop over all devices @@ -78,8 +78,8 @@ void GetXInputGUIDS( std::vector<DWORD>& guids ) for (UINT iDevice = 0; iDevice < uReturned; ++iDevice) { // For each device, get its device ID - hr = pDevices[iDevice]->Get(bstrDeviceID, 0L, &var, NULL, NULL); - if (SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != NULL) + hr = pDevices[iDevice]->Get(bstrDeviceID, 0L, &var, nullptr, nullptr); + if (SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != nullptr) { // Check if the device ID contains "IG_". If it does, then it's an XInput device // This information can not be found from DirectInput @@ -140,7 +140,7 @@ void InitJoystick(IDirectInput8* const idi8, std::vector<Core::Device*>& devices continue; LPDIRECTINPUTDEVICE8 js_device; - if (SUCCEEDED(idi8->CreateDevice(joystick.guidInstance, &js_device, NULL))) + if (SUCCEEDED(idi8->CreateDevice(joystick.guidInstance, &js_device, nullptr))) { if (SUCCEEDED(js_device->SetDataFormat(&c_dfDIJoystick))) { @@ -148,7 +148,7 @@ void InitJoystick(IDirectInput8* const idi8, std::vector<Core::Device*>& devices { //PanicAlert("SetCooperativeLevel(DISCL_EXCLUSIVE) failed!"); // fall back to non-exclusive mode, with no rumble - if (FAILED(js_device->SetCooperativeLevel(NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) + if (FAILED(js_device->SetCooperativeLevel(nullptr, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) { //PanicAlert("SetCooperativeLevel failed!"); js_device->Release(); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp index 0cd55b448c..52960bbc3c 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp @@ -52,20 +52,20 @@ void InitKeyboardMouse(IDirectInput8* const idi8, std::vector<Core::Device*>& de // if that's dumb, I will make a VirtualDevice class that just uses ranges of inputs/outputs from other devices // so there can be a separated Keyboard and mouse, as well as combined KeyboardMouse - LPDIRECTINPUTDEVICE8 kb_device = NULL; - LPDIRECTINPUTDEVICE8 mo_device = NULL; + LPDIRECTINPUTDEVICE8 kb_device = nullptr; + LPDIRECTINPUTDEVICE8 mo_device = nullptr; - if (SUCCEEDED(idi8->CreateDevice( GUID_SysKeyboard, &kb_device, NULL))) + if (SUCCEEDED(idi8->CreateDevice( GUID_SysKeyboard, &kb_device, nullptr))) { if (SUCCEEDED(kb_device->SetDataFormat(&c_dfDIKeyboard))) { - if (SUCCEEDED(kb_device->SetCooperativeLevel(NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) + if (SUCCEEDED(kb_device->SetCooperativeLevel(nullptr, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) { - if (SUCCEEDED(idi8->CreateDevice( GUID_SysMouse, &mo_device, NULL ))) + if (SUCCEEDED(idi8->CreateDevice( GUID_SysMouse, &mo_device, nullptr ))) { if (SUCCEEDED(mo_device->SetDataFormat(&c_dfDIMouse2))) { - if (SUCCEEDED(mo_device->SetCooperativeLevel(NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) + if (SUCCEEDED(mo_device->SetCooperativeLevel(nullptr, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))) { devices.push_back(new KeyboardMouse(kb_device, mo_device)); return; diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index 295fc10b5a..e1383efc9d 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -46,7 +46,7 @@ Device::Input* Device::FindInput(const std::string &name) const return input; } - return NULL; + return nullptr; } Device::Output* Device::FindOutput(const std::string &name) const @@ -57,7 +57,7 @@ Device::Output* Device::FindOutput(const std::string &name) const return output; } - return NULL; + return nullptr; } // @@ -151,7 +151,7 @@ Device* DeviceContainer::FindDevice(const DeviceQualifier& devq) const return d; } - return NULL; + return nullptr; } Device::Input* DeviceContainer::FindInput(const std::string& name, const Device* def_dev) const @@ -171,7 +171,7 @@ Device::Input* DeviceContainer::FindInput(const std::string& name, const Device* return i; } - return NULL; + return nullptr; } Device::Output* DeviceContainer::FindOutput(const std::string& name, const Device* def_dev) const diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h index 43f1b738c7..a096bcb8b9 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.h +++ b/Source/Core/InputCommon/ControllerInterface/Device.h @@ -42,8 +42,8 @@ public: virtual std::string GetName() const = 0; virtual ~Control() {} - virtual Input* ToInput() { return NULL; } - virtual Output* ToOutput() { return NULL; } + virtual Input* ToInput() { return nullptr; } + virtual Output* ToOutput() { return nullptr; } }; // diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp index 4e2f49f4d0..c41e82b699 100644 --- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp @@ -357,7 +357,7 @@ Device::Control *ControlFinder::FindControl(ControlQualifier qualifier) { Device *device = FindDevice(qualifier); if (!device) - return NULL; + return nullptr; if (is_input) return device->FindInput(qualifier.control_name); @@ -414,7 +414,7 @@ private: case TOK_CONTROL: { Device::Control *control = finder.FindControl(tok.qualifier); - if (control == NULL) + if (control == nullptr) return EXPRESSION_PARSE_NO_DEVICE; *expr_out = new ControlExpression(tok.qualifier, control); @@ -539,7 +539,7 @@ ExpressionParseStatus ParseExpressionInner(std::string str, ControlFinder &finde { ExpressionParseStatus status; Expression *expr; - *expr_out = NULL; + *expr_out = nullptr; if (str == "") return EXPRESSION_PARSE_SUCCESS; diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h index 18f972ce9e..f2628e6f0b 100644 --- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h +++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h @@ -47,7 +47,7 @@ class ExpressionNode; class Expression { public: - Expression() : node(NULL) {} + Expression() : node(nullptr) {} Expression(ExpressionNode *node); ~Expression(); ControlState GetValue(); diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp index 7a4dfdaccc..036b3fda05 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp @@ -102,7 +102,7 @@ bool ForceFeedbackDevice::InitForceFeedback(const LPDIRECTINPUTDEVICE8 device, i } LPDIRECTINPUTEFFECT pEffect; - if (SUCCEEDED(device->CreateEffect(f.guid, &eff, &pEffect, NULL))) + if (SUCCEEDED(device->CreateEffect(f.guid, &eff, &pEffect, nullptr))) { m_state_out.push_back(EffectState(pEffect)); @@ -155,7 +155,7 @@ bool ForceFeedbackDevice::UpdateOutput() ok_count += SUCCEEDED(state.iface->Stop()); } - state.params = NULL; + state.params = nullptr; } else { diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h index 9ef5873702..643ca2434b 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h @@ -29,7 +29,7 @@ class ForceFeedbackDevice : public Core::Device private: struct EffectState { - EffectState(LPDIRECTINPUTEFFECT eff) : iface(eff), params(NULL), size(0) {} + EffectState(LPDIRECTINPUTEFFECT eff) : iface(eff), params(nullptr), size(0) {} LPDIRECTINPUTEFFECT iface; void* params; // null when force hasn't changed diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h index 3ac954c9ad..c3b5cef2ef 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h @@ -72,11 +72,11 @@ public: HRESULT QueryInterface(REFIID iid, LPVOID *ppv) { - *ppv = NULL; + *ppv = nullptr; if (CFEqual(&iid, IUnknownUUID)) *ppv = this; - if (NULL == *ppv) + if (nullptr == *ppv) return E_NOINTERFACE; ((IUnknown*)*ppv)->AddRef(); diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm index 50b568cb9a..ac98c4c13d 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm @@ -18,7 +18,7 @@ namespace OSX { -static IOHIDManagerRef HIDManager = NULL; +static IOHIDManagerRef HIDManager = nullptr; static CFStringRef OurRunLoop = CFSTR("DolphinOSXInput"); static std::map<std::string, int> kbd_name_counts, joy_name_counts; @@ -90,7 +90,7 @@ void DeviceElementDebugPrint(const void *value, void *context) type == "collection" ? c_type.c_str() : " ", IOHIDElementGetUsagePage(e), IOHIDElementGetUsage(e), - IOHIDElementGetName(e), // usually just NULL + IOHIDElementGetName(e), // usually just nullptr IOHIDElementGetLogicalMin(e), IOHIDElementGetLogicalMax(e), IOHIDElementGetPhysicalMin(e), @@ -102,7 +102,7 @@ void DeviceElementDebugPrint(const void *value, void *context) CFRange range = {0, CFArrayGetCount(elements)}; // this leaks...but it's just debug code, right? :D CFArrayApplyFunction(elements, range, - DeviceElementDebugPrint, NULL); + DeviceElementDebugPrint, nullptr); } } @@ -146,7 +146,7 @@ static void DeviceMatching_callback(void* inContext, { NSString *pName = (NSString *) IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(kIOHIDProductKey)); - std::string name = (pName != NULL) ? [pName UTF8String] : "Unknown device"; + std::string name = (pName != nullptr) ? [pName UTF8String] : "Unknown device"; DeviceDebugPrint(inIOHIDDeviceRef); @@ -178,7 +178,7 @@ void Init(std::vector<Core::Device*>& devices, void *window) g_window = window; - IOHIDManagerSetDeviceMatching(HIDManager, NULL); + IOHIDManagerSetDeviceMatching(HIDManager, nullptr); // Callbacks for acquisition or loss of a matching device IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, @@ -200,7 +200,7 @@ void Init(std::vector<Core::Device*>& devices, void *window) // Things should be configured now // Disable hotplugging and other scheduling - IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, NULL, NULL); + IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, nullptr, nullptr); IOHIDManagerUnscheduleFromRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop); } diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm index 6e0623e716..f7f59e1c41 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm @@ -39,7 +39,7 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) { IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(buttons, i); - //DeviceElementDebugPrint(e, NULL); + //DeviceElementDebugPrint(e, nullptr); AddInput(new Button(e, m_device)); } @@ -62,7 +62,7 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) { IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(axes, i); - //DeviceElementDebugPrint(e, NULL); + //DeviceElementDebugPrint(e, nullptr); if (IOHIDElementGetUsage(e) == kHIDUsage_GD_Hatswitch) { AddInput(new Hat(e, m_device, Hat::up)); diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm index fc784b81c6..ecb841ae7b 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm @@ -40,7 +40,7 @@ Keyboard::Keyboard(IOHIDDeviceRef device, std::string name, int index, void *win { IOHIDElementRef e = (IOHIDElementRef)CFArrayGetValueAtIndex(elements, i); - //DeviceElementDebugPrint(e, NULL); + //DeviceElementDebugPrint(e, nullptr); AddInput(new Key(e, m_device)); } @@ -61,7 +61,7 @@ bool Keyboard::UpdateInput() { CGRect bounds = CGRectZero; uint32_t windowid[1] = { m_windowid }; - CFArrayRef windowArray = CFArrayCreate(NULL, (const void **) windowid, 1, NULL); + CFArrayRef windowArray = CFArrayCreate(nullptr, (const void **) windowid, 1, nullptr); CFArrayRef windowDescriptions = CGWindowListCreateDescriptionFromArray(windowArray); CFDictionaryRef windowDescription = (CFDictionaryRef) CFArrayGetValueAtIndex((CFArrayRef) windowDescriptions, 0); @@ -69,7 +69,7 @@ bool Keyboard::UpdateInput() { CFDictionaryRef boundsDictionary = (CFDictionaryRef) CFDictionaryGetValue(windowDescription, kCGWindowBounds); - if (boundsDictionary != NULL) + if (boundsDictionary != nullptr) CGRectMakeWithDictionaryRepresentation(boundsDictionary, &bounds); } diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index 802346b81d..9fb9e96f6e 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -48,7 +48,7 @@ namespace XInput2 // This function will add zero or more KeyboardMouse objects to devices. void Init(std::vector<Core::Device*>& devices, void* const hwnd) { - Display* dpy = XOpenDisplay(NULL); + Display* dpy = XOpenDisplay(nullptr); // xi_opcode is important; it will be used to identify XInput events by // the polling loop in UpdateInput. @@ -129,7 +129,7 @@ KeyboardMouse::KeyboardMouse(Window window, int opcode, int pointer, int keyboar // which it can individually filter to get just the events it's interested // in. So be aware that each KeyboardMouse object actually has its own X11 // "context." - m_display = XOpenDisplay(NULL); + m_display = XOpenDisplay(nullptr); int min_keycode, max_keycode; XDisplayKeycodes(m_display, &min_keycode, &max_keycode); @@ -326,7 +326,7 @@ KeyboardMouse::Key::Key(Display* const display, KeyCode keycode, const char* key // 0x0110ffff is the top of the unicode character range according // to keysymdef.h although it is probably more than we need. if (keysym == NoSymbol || keysym > 0x0110ffff || - XKeysymToString(keysym) == NULL) + XKeysymToString(keysym) == nullptr) m_keyname = std::string(); else m_keyname = std::string(XKeysymToString(keysym)); diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp index 0d2bdab8f8..18f1141c6d 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/Xlib.cpp @@ -16,7 +16,7 @@ KeyboardMouse::KeyboardMouse(Window window) : m_window(window) { memset(&m_state, 0, sizeof(m_state)); - m_display = XOpenDisplay(NULL); + m_display = XOpenDisplay(nullptr); int min_keycode, max_keycode; XDisplayKeycodes(m_display, &min_keycode, &max_keycode); @@ -107,7 +107,7 @@ KeyboardMouse::Key::Key(Display* const display, KeyCode keycode, const char* key // 0x0110ffff is the top of the unicode character range according // to keysymdef.h although it is probably more than we need. if (keysym == NoSymbol || keysym > 0x0110ffff || - XKeysymToString(keysym) == NULL) + XKeysymToString(keysym) == nullptr) m_keyname = std::string(); else m_keyname = std::string(XKeysymToString(keysym)); diff --git a/Source/Core/InputCommon/UDPWiimote.cpp b/Source/Core/InputCommon/UDPWiimote.cpp index a50dbc17ca..1dad7d52d2 100644 --- a/Source/Core/InputCommon/UDPWiimote.cpp +++ b/Source/Core/InputCommon/UDPWiimote.cpp @@ -72,7 +72,7 @@ UDPWiimote::UDPWiimote(const char *_port, const char * name, int _index) : static bool sranded=false; if (!sranded) { - srand((unsigned int)time(0)); + srand((unsigned int)time(nullptr)); sranded=true; } bcastMagic=rand() & 0xFFFF; @@ -107,7 +107,7 @@ UDPWiimote::UDPWiimote(const char *_port, const char * name, int _index) : return; } - if ((rv = getaddrinfo(NULL, _port, &hints, &servinfo)) != 0) + if ((rv = getaddrinfo(nullptr, _port, &hints, &servinfo)) != 0) { cleanup; err=-1; @@ -115,7 +115,7 @@ UDPWiimote::UDPWiimote(const char *_port, const char * name, int _index) : } // loop through all the results and bind to everything we can - for(p = servinfo; p != NULL; p = p->ai_next) + for(p = servinfo; p != nullptr; p = p->ai_next) { sock_t sock; if ((sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == BAD_SOCK) @@ -191,7 +191,7 @@ void UDPWiimote::mainThread() lk.unlock(); //VERY hacky. don't like it if (d->exit) return; - int rt=select(maxfd,&fds,NULL,NULL,&timeout); + int rt=select(maxfd,&fds,nullptr,nullptr,&timeout); if (d->exit) return; lk.lock(); if (d->exit) return; diff --git a/Source/Core/InputCommon/UDPWrapper.cpp b/Source/Core/InputCommon/UDPWrapper.cpp index 19eb619679..a205fb0280 100644 --- a/Source/Core/InputCommon/UDPWrapper.cpp +++ b/Source/Core/InputCommon/UDPWrapper.cpp @@ -18,7 +18,7 @@ const std::string DefaultPort(const int index) UDPWrapper::UDPWrapper(int indx, const char* const _name) : ControllerEmu::ControlGroup(_name,GROUP_TYPE_UDPWII), - inst(NULL), index(indx), + inst(nullptr), index(indx), updIR(false),updAccel(false), updButt(false),udpEn(false) , port(DefaultPort(indx)) @@ -68,7 +68,7 @@ void UDPWrapper::SaveConfig(IniFile::Section *sec, const std::string& defdev, co void UDPWrapper::Refresh() { - bool udpAEn=(inst!=NULL); + bool udpAEn=(inst!=nullptr); if (udpEn&&udpAEn) { if (strcmp(inst->getPort(),port.c_str())) @@ -82,7 +82,7 @@ void UDPWrapper::Refresh() { if (inst) delete inst; - inst = NULL; + inst = nullptr; return; } //else |
