Replace NULL and 0 with nullptr

This commit is contained in:
Jonas Kvinge
2018-11-14 00:43:19 +01:00
parent 542cc0ec2f
commit 718bd4c081
7 changed files with 827 additions and 827 deletions

View File

@@ -157,7 +157,7 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
Sleep(DWORD(ms)); Sleep(DWORD(ms));
#else #else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL); nanosleep(&ts, nullptr);
#endif #endif
} }
if (!connOk) if (!connOk)

View File

@@ -58,7 +58,7 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
Qt::HANDLE mutex; Qt::HANDLE mutex;
if (doCreate) { if (doCreate) {
mutex = CreateMutexW(NULL, FALSE, (WCHAR*)mname.utf16()); mutex = CreateMutexW(nullptr, FALSE, (WCHAR*)mname.utf16());
if (!mutex) { if (!mutex) {
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed"); qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
return 0; return 0;

View File

@@ -47,9 +47,9 @@ class QXT_GUI_EXPORT QxtGlobalShortcut : public QObject
Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut)
public: public:
explicit QxtGlobalShortcut(QObject* parent = 0); explicit QxtGlobalShortcut(QObject* parent = nullptr);
explicit QxtGlobalShortcut(const QKeySequence& shortcut, QObject* parent = 0); explicit QxtGlobalShortcut(const QKeySequence& shortcut, QObject* parent = nullptr);
virtual ~QxtGlobalShortcut(); ~QxtGlobalShortcut();
QKeySequence shortcut() const; QKeySequence shortcut() const;
bool setShortcut(const QKeySequence& shortcut); bool setShortcut(const QKeySequence& shortcut);

View File

@@ -48,7 +48,7 @@ OSStatus qxt_mac_handle_hot_key(EventHandlerCallRef nextHandler, EventRef event,
if (GetEventClass(event) == kEventClassKeyboard && GetEventKind(event) == kEventHotKeyPressed) if (GetEventClass(event) == kEventClassKeyboard && GetEventKind(event) == kEventHotKeyPressed)
{ {
EventHotKeyID keyID; EventHotKeyID keyID;
GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(keyID), NULL, &keyID); GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, nullptr, sizeof(keyID), nullptr, &keyID);
Identifier id = keyIDs.key(keyID.id); Identifier id = keyIDs.key(keyID.id);
QxtGlobalShortcutPrivate::activateShortcut(id.second, id.first); QxtGlobalShortcutPrivate::activateShortcut(id.second, id.first);
} }
@@ -174,12 +174,12 @@ quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key)
CFDataRef currentLayoutData; CFDataRef currentLayoutData;
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource(); TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
if (currentKeyboard == NULL) if (currentKeyboard == nullptr)
return 0; return 0;
currentLayoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); currentLayoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
CFRelease(currentKeyboard); CFRelease(currentKeyboard);
if (currentLayoutData == NULL) if (currentLayoutData == nullptr)
return 0; return 0;
UCKeyboardLayout* header = (UCKeyboardLayout*)CFDataGetBytePtr(currentLayoutData); UCKeyboardLayout* header = (UCKeyboardLayout*)CFDataGetBytePtr(currentLayoutData);
@@ -230,7 +230,7 @@ bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativ
EventTypeSpec t; EventTypeSpec t;
t.eventClass = kEventClassKeyboard; t.eventClass = kEventClassKeyboard;
t.eventKind = kEventHotKeyPressed; t.eventKind = kEventHotKeyPressed;
InstallApplicationEventHandler(&qxt_mac_handle_hot_key, 1, &t, NULL, NULL); InstallApplicationEventHandler(&qxt_mac_handle_hot_key, 1, &t, nullptr, nullptr);
} }
EventHotKeyID keyID; EventHotKeyID keyID;

View File

@@ -113,7 +113,7 @@ public:
bool isValid() bool isValid()
{ {
return m_display != 0; return m_display != nullptr;
} }
Display *display() Display *display()
@@ -176,14 +176,14 @@ bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType,
{ {
Q_UNUSED(result); Q_UNUSED(result);
xcb_key_press_event_t *kev = 0; xcb_key_press_event_t *kev = nullptr;
if (eventType == "xcb_generic_event_t") { if (eventType == "xcb_generic_event_t") {
xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message); xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message);
if ((ev->response_type & 127) == XCB_KEY_PRESS) if ((ev->response_type & 127) == XCB_KEY_PRESS)
kev = static_cast<xcb_key_press_event_t *>(message); kev = static_cast<xcb_key_press_event_t *>(message);
} }
if (kev != 0) { if (kev != nullptr) {
unsigned int keycode = kev->detail; unsigned int keycode = kev->detail;
unsigned int keystate = 0; unsigned int keystate = 0;
if(kev->state & XCB_MOD_MASK_1) if(kev->state & XCB_MOD_MASK_1)