From ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 14:46:58 +0100 Subject: Tidy nullptr usage Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/plugins/platforms/eglfs/api/qeglfscontext.cpp | 2 +- src/plugins/platforms/eglfs/api/qeglfscursor.cpp | 2 +- src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 18 +++++++++--------- .../platforms/eglfs/api/qeglfsoffscreenwindow.cpp | 2 +- src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 4 ++-- src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 8 ++++---- .../deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp | 4 ++-- .../eglfs_x11/qeglfsx11integration.cpp | 16 ++++++++-------- .../deviceintegration/eglfs_x11/qeglfsx11integration.h | 2 +- src/plugins/platforms/eglfs/qeglfsmain.cpp | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src/plugins/platforms/eglfs') diff --git a/src/plugins/platforms/eglfs/api/qeglfscontext.cpp b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp index c10b6facbb..48fafbda8d 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp @@ -78,7 +78,7 @@ EGLSurface QEglFSContext::createTemporaryOffscreenSurface() } } EGLConfig config = q_configFromGLFormat(eglDisplay(), format()); - return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, 0); + return eglCreateWindowSurface(eglDisplay(), config, m_tempWindow, nullptr); } void QEglFSContext::destroyTemporaryOffscreenSurface(EGLSurface surface) diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 22319fcc66..98e05195ee 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -62,7 +62,7 @@ QEglFSCursor::QEglFSCursor(QPlatformScreen *screen) : m_visible(true), m_screen(static_cast(screen)), m_activeScreen(nullptr), - m_deviceListener(0), + m_deviceListener(nullptr), m_updateRequested(false) { QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index d3f51c0d0e..d9a3545a95 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -109,10 +109,10 @@ QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() : m_display(EGL_NO_DISPLAY), - m_inputContext(0), + m_inputContext(nullptr), m_fontDb(new QGenericUnixFontDatabase), m_services(new QGenericUnixServices), - m_kbdMgr(0), + m_kbdMgr(nullptr), m_disableInputHandlers(false) { m_disableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT"); @@ -223,7 +223,7 @@ QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLCo EGLConfig config = QEglFSDeviceIntegration::chooseConfig(dpy, adjustedFormat); ctx = new QEglFSContext(adjustedFormat, share, dpy, &config, QVariant()); } else { - ctx = new QEglFSContext(adjustedFormat, share, dpy, 0, nativeHandle); + ctx = new QEglFSContext(adjustedFormat, share, dpy, nullptr, nativeHandle); } nativeHandle = QVariant::fromValue(QEGLNativeContext(ctx->eglContext(), dpy)); @@ -307,7 +307,7 @@ static int resourceType(const QByteArray &key) void *QEglFSIntegration::nativeResourceForIntegration(const QByteArray &resource) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case EglDisplay: @@ -329,7 +329,7 @@ void *QEglFSIntegration::nativeResourceForIntegration(const QByteArray &resource void *QEglFSIntegration::nativeResourceForScreen(const QByteArray &resource, QScreen *screen) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case XlibDisplay: @@ -347,7 +347,7 @@ void *QEglFSIntegration::nativeResourceForScreen(const QByteArray &resource, QSc void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case EglDisplay: @@ -374,7 +374,7 @@ void *QEglFSIntegration::nativeResourceForWindow(const QByteArray &resource, QWi #ifndef QT_NO_OPENGL void *QEglFSIntegration::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) { - void *result = 0; + void *result = nullptr; switch (resourceType(resource)) { case EglContext: @@ -402,7 +402,7 @@ static void *eglContextForContext(QOpenGLContext *context) QEglFSContext *handle = static_cast(context->handle()); if (!handle) - return 0; + return nullptr; return handle->eglContext(); } @@ -416,7 +416,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na #else Q_UNUSED(resource); #endif - return 0; + return nullptr; } QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const diff --git a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp index 864271cd3a..c96e329816 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp @@ -67,7 +67,7 @@ QEglFSOffscreenWindow::QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceF return; } EGLConfig config = q_configFromGLFormat(m_display, m_format); - m_surface = eglCreateWindowSurface(m_display, config, m_window, 0); + m_surface = eglCreateWindowSurface(m_display, config, m_window, nullptr); if (m_surface != EGL_NO_SURFACE) m_format = q_glFormatFromConfig(m_display, config); } diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index 11b68c0589..8a8e8cd563 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QEglFSScreen::QEglFSScreen(EGLDisplay dpy) : m_dpy(dpy), m_surface(EGL_NO_SURFACE), - m_cursor(0) + m_cursor(nullptr) { m_cursor = qt_egl_device_integration()->createCursor(this); } @@ -164,7 +164,7 @@ void QEglFSScreen::handleCursorMove(const QPoint &pos) return; } - QWindow *enter = 0, *leave = 0; + QWindow *enter = nullptr, *leave = nullptr; for (int i = windows.count() - 1; i >= 0; --i) { QWindow *window = windows[i]->sourceWindow(); const QRect geom = window->geometry(); diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 3457be116a..f7e116eb88 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -61,8 +61,8 @@ QT_BEGIN_NAMESPACE QEglFSWindow::QEglFSWindow(QWindow *w) : QPlatformWindow(w), #ifndef QT_NO_OPENGL - m_backingStore(0), - m_rasterCompositingContext(0), + m_backingStore(nullptr), + m_rasterCompositingContext(nullptr), #endif m_winId(0), m_surface(EGL_NO_SURFACE), @@ -207,7 +207,7 @@ void QEglFSWindow::resetSurface() m_format = q_glFormatFromConfig(display, m_config, platformFormat); const QSize surfaceSize = screen()->rawGeometry().size(); m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format); - m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL); + m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr); } void QEglFSWindow::setVisible(bool visible) @@ -337,7 +337,7 @@ const QPlatformTextureList *QEglFSWindow::textures() const if (m_backingStore) return m_backingStore->textures(); - return 0; + return nullptr; } void QEglFSWindow::endCompositing() diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp index 1125bcb390..dc98cdce4b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp @@ -69,7 +69,7 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen) : m_screen(screen) , m_cursorSize(64, 64) // 64x64 is the old standard size, we now try to query the real size below , m_bo(nullptr) - , m_cursorImage(0, 0, 0, 0, 0, 0) + , m_cursorImage(nullptr, nullptr, 0, 0, 0, 0) , m_state(CursorPendingVisible) , m_deviceListener(nullptr) { @@ -102,7 +102,7 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen) #ifndef QT_NO_CURSOR QCursor cursor(Qt::ArrowCursor); - changeCursor(&cursor, 0); + changeCursor(&cursor, nullptr); #endif setPos(QPoint(0, 0)); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp index 07b2de7c58..ce5a721906 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp @@ -75,7 +75,7 @@ void EventReader::run() if (client->format == 32 && client->type == atoms[Atoms::WM_PROTOCOLS] && client->data.data32[0] == atoms[Atoms::WM_DELETE_WINDOW]) { - QWindow *window = m_integration->platformWindow() ? m_integration->platformWindow()->window() : 0; + QWindow *window = m_integration->platformWindow() ? m_integration->platformWindow()->window() : nullptr; if (window) QWindowSystemInterface::handleCloseEvent(window); } @@ -106,7 +106,7 @@ void QEglFSX11Integration::sendConnectionEvent(xcb_atom_t a) void QEglFSX11Integration::platformInit() { - m_display = XOpenDisplay(0); + m_display = XOpenDisplay(nullptr); if (Q_UNLIKELY(!m_display)) qFatal("Could not open display"); @@ -121,7 +121,7 @@ void QEglFSX11Integration::platformInit() xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_connectionEventListener, it.data->root, 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY, - it.data->root_visual, 0, 0); + it.data->root_visual, 0, nullptr); m_eventReader = new EventReader(this); m_eventReader->start(); @@ -135,11 +135,11 @@ void QEglFSX11Integration::platformDestroy() m_eventReader->wait(); delete m_eventReader; - m_eventReader = 0; + m_eventReader = nullptr; XCloseDisplay(DISPLAY); - m_display = 0; - m_connection = 0; + m_display = nullptr; + m_connection = nullptr; } EGLNativeDisplayType QEglFSX11Integration::platformDisplay() const @@ -175,7 +175,7 @@ EGLNativeWindowType QEglFSX11Integration::createNativeWindow(QPlatformWindow *pl xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_window, it.data->root, 0, 0, size.width(), size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, it.data->root_visual, - 0, 0); + 0, nullptr); xcb_intern_atom_cookie_t cookies[Atoms::N_ATOMS]; static const char *atomNames[Atoms::N_ATOMS] = { @@ -189,7 +189,7 @@ EGLNativeWindowType QEglFSX11Integration::createNativeWindow(QPlatformWindow *pl for (int i = 0; i < Atoms::N_ATOMS; ++i) { cookies[i] = xcb_intern_atom(m_connection, false, strlen(atomNames[i]), atomNames[i]); - xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i], 0); + xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i], nullptr); m_atoms[i] = reply->atom; free(reply); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h index bf431caaac..ebcc19b682 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h @@ -67,7 +67,7 @@ class EventReader; class QEglFSX11Integration : public QEglFSDeviceIntegration { public: - QEglFSX11Integration() : m_connection(0), m_window(0), m_eventReader(0) {} + QEglFSX11Integration() : m_connection(nullptr), m_window(0), m_eventReader(nullptr) {} void platformInit() override; void platformDestroy() override; diff --git a/src/plugins/platforms/eglfs/qeglfsmain.cpp b/src/plugins/platforms/eglfs/qeglfsmain.cpp index 4f77b7cd17..b41bbec27d 100644 --- a/src/plugins/platforms/eglfs/qeglfsmain.cpp +++ b/src/plugins/platforms/eglfs/qeglfsmain.cpp @@ -56,7 +56,7 @@ QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, con if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) return new QEglFSIntegration; - return 0; + return nullptr; } QT_END_NAMESPACE -- cgit v1.2.3