plugins: use nullptr instead of 0 and NULL

Change-Id: I7f3e56db1d0db178d8a7d9eb91c09e03cae89f6b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Johannes Kauffmann 2022-09-20 01:59:44 +02:00
parent 42e48b4706
commit d3f748c340
25 changed files with 45 additions and 41 deletions

View File

@ -27,7 +27,8 @@ QObject* QEvdevKeyboardPlugin::create(const QString &key,
{ {
if (!key.compare(QLatin1String("EvdevKeyboard"), Qt::CaseInsensitive)) if (!key.compare(QLatin1String("EvdevKeyboard"), Qt::CaseInsensitive))
return new QEvdevKeyboardManager(key, specification); return new QEvdevKeyboardManager(key, specification);
return 0;
return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -27,7 +27,8 @@ QObject* QEvdevMousePlugin::create(const QString &key,
{ {
if (!key.compare(QLatin1String("EvdevMouse"), Qt::CaseInsensitive)) if (!key.compare(QLatin1String("EvdevMouse"), Qt::CaseInsensitive))
return new QEvdevMouseManager(key, specification); return new QEvdevMouseManager(key, specification);
return 0;
return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -27,7 +27,7 @@ QObject* QEvdevTabletPlugin::create(const QString &key,
if (!key.compare(QLatin1String("EvdevTablet"), Qt::CaseInsensitive)) if (!key.compare(QLatin1String("EvdevTablet"), Qt::CaseInsensitive))
return new QEvdevTabletManager(key, spec); return new QEvdevTabletManager(key, spec);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -27,7 +27,7 @@ QObject* QEvdevTouchScreenPlugin::create(const QString &key,
if (!key.compare(QLatin1String("EvdevTouch"), Qt::CaseInsensitive)) if (!key.compare(QLatin1String("EvdevTouch"), Qt::CaseInsensitive))
return new QEvdevTouchManager(key, spec); return new QEvdevTouchManager(key, spec);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -20,7 +20,7 @@ QObject *QLibInputPlugin::create(const QString &key, const QString &specificatio
if (!key.compare(QLatin1String("libinput"), Qt::CaseInsensitive)) if (!key.compare(QLatin1String("libinput"), Qt::CaseInsensitive))
return new QLibInputHandler(key, specification); return new QLibInputHandler(key, specification);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -22,7 +22,7 @@ QObject* QTsLibPlugin::create(const QString &key,
|| !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive)) || !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive))
return new QTsLibMouseHandler(key, specification); return new QTsLibMouseHandler(key, specification);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -30,7 +30,7 @@ QObject* QTuioTouchPlugin::create(const QString &key,
if (!key.compare(QLatin1String("TuioTouch"), Qt::CaseInsensitive)) if (!key.compare(QLatin1String("TuioTouch"), Qt::CaseInsensitive))
return new QTuioHandler(spec); return new QTuioHandler(spec);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -161,7 +161,7 @@ class PropertiesDBusInterface : public QDBusAbstractInterface
{ {
public: public:
PropertiesDBusInterface(const QString &service, const QString &path, const QString &interface, PropertiesDBusInterface(const QString &service, const QString &path, const QString &interface,
const QDBusConnection &connection, QObject *parent = 0) const QDBusConnection &connection, QObject *parent = nullptr)
: QDBusAbstractInterface(service, path, interface.toLatin1().data(), connection, parent) : QDBusAbstractInterface(service, path, interface.toLatin1().data(), connection, parent)
{ {
} }

View File

@ -30,7 +30,8 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString
qDBusRegisterMetaType<QIBusText>(); qDBusRegisterMetaType<QIBusText>();
return new QIBusPlatformInputContext; return new QIBusPlatformInputContext;
} }
return 0;
return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -468,7 +468,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
if (!filtered) { if (!filtered) {
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu
&& window != NULL) { && window != nullptr) {
const QPoint globalPos = window->screen()->handle()->cursor()->pos(); const QPoint globalPos = window->screen()->handle()->cursor()->pos();
const QPoint pos = window->mapFromGlobal(globalPos); const QPoint pos = window->mapFromGlobal(globalPos);
QWindowSystemInterfacePrivate::ContextMenuEvent contextMenuEvent(window, false, pos, QWindowSystemInterfacePrivate::ContextMenuEvent contextMenuEvent(window, false, pos,
@ -581,10 +581,10 @@ static bool shouldConnectIbusPortal()
} }
QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate() QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate()
: connection(0), : connection(nullptr),
bus(0), bus(nullptr),
portalBus(0), portalBus(nullptr),
context(0), context(nullptr),
usePortal(shouldConnectIbusPortal()), usePortal(shouldConnectIbusPortal()),
valid(false), valid(false),
busConnected(false), busConnected(false),
@ -721,7 +721,7 @@ QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
QFile file(getSocketPath()); QFile file(getSocketPath());
if (!file.open(QFile::ReadOnly)) if (!file.open(QFile::ReadOnly))
return 0; return nullptr;
QByteArray address; QByteArray address;
int pid = -1; int pid = -1;
@ -740,7 +740,7 @@ QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
if (debug) if (debug)
qDebug() << "IBUS_ADDRESS=" << address << "PID=" << pid; qDebug() << "IBUS_ADDRESS=" << address << "PID=" << pid;
if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0) if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)
return 0; return nullptr;
return new QDBusConnection(QDBusConnection::connectToBus(QString::fromLatin1(address), "QIBusProxy"_L1)); return new QDBusConnection(QDBusConnection::connectToBus(QString::fromLatin1(address), "QIBusProxy"_L1));
} }

View File

@ -22,7 +22,7 @@ QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, c
if (!system.compare("linuxfb"_L1, Qt::CaseInsensitive)) if (!system.compare("linuxfb"_L1, Qt::CaseInsensitive))
return new QLinuxFbIntegration(paramList); return new QLinuxFbIntegration(paramList);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -243,7 +243,7 @@ bool QLinuxFbDevice::createFramebuffer(QLinuxFbDevice::Output *output, int buffe
qErrnoWarning(errno, "Failed to map dumb buffer"); qErrnoWarning(errno, "Failed to map dumb buffer");
return false; return false;
} }
fb.p = mmap(0, fb.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd(), mreq.offset); fb.p = mmap(nullptr, fb.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd(), mreq.offset);
if (fb.p == MAP_FAILED) { if (fb.p == MAP_FAILED) {
qErrnoWarning(errno, "Failed to mmap dumb buffer"); qErrnoWarning(errno, "Failed to mmap dumb buffer");
return false; return false;

View File

@ -42,7 +42,7 @@ QLinuxFbIntegration::QLinuxFbIntegration(const QStringList &paramList)
: m_primaryScreen(nullptr), : m_primaryScreen(nullptr),
m_fontDb(new QGenericUnixFontDatabase), m_fontDb(new QGenericUnixFontDatabase),
m_services(new QGenericUnixServices), m_services(new QGenericUnixServices),
m_kbdMgr(0) m_kbdMgr(nullptr)
{ {
#if QT_CONFIG(kms) #if QT_CONFIG(kms)
if (qEnvironmentVariableIntValue("QT_QPA_FB_DRM") != 0) if (qEnvironmentVariableIntValue("QT_QPA_FB_DRM") != 0)
@ -147,7 +147,7 @@ QPlatformNativeInterface *QLinuxFbIntegration::nativeInterface() const
QFunctionPointer QLinuxFbIntegration::platformFunction(const QByteArray &function) const QFunctionPointer QLinuxFbIntegration::platformFunction(const QByteArray &function) const
{ {
Q_UNUSED(function); Q_UNUSED(function);
return 0; return nullptr;
} }
#if QT_CONFIG(evdev) #if QT_CONFIG(evdev)

View File

@ -213,7 +213,7 @@ static QImage::Format determineFormat(const fb_var_screeninfo &info, int depth)
static int openTtyDevice(const QString &device) static int openTtyDevice(const QString &device)
{ {
const char *const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", 0 }; const char *const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", nullptr };
int fd = -1; int fd = -1;
if (device.isEmpty()) { if (device.isEmpty()) {
@ -253,9 +253,9 @@ static void blankScreen(int fd, bool on)
} }
QLinuxFbScreen::QLinuxFbScreen(const QStringList &args) QLinuxFbScreen::QLinuxFbScreen(const QStringList &args)
: mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0) : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(nullptr)
{ {
mMmap.data = 0; mMmap.data = nullptr;
} }
QLinuxFbScreen::~QLinuxFbScreen() QLinuxFbScreen::~QLinuxFbScreen()
@ -344,7 +344,7 @@ bool QLinuxFbScreen::initialize()
// mmap the framebuffer // mmap the framebuffer
mMmap.size = finfo.smem_len; mMmap.size = finfo.smem_len;
uchar *data = (unsigned char *)mmap(0, mMmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, mFbFd, 0); uchar *data = (unsigned char *)mmap(nullptr, mMmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, mFbFd, 0);
if ((long)data == -1) { if ((long)data == -1) {
qErrnoWarning(errno, "Failed to mmap framebuffer"); qErrnoWarning(errno, "Failed to mmap framebuffer");
return false; return false;

View File

@ -22,7 +22,7 @@ QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, c
if (!system.compare("minimal"_L1, Qt::CaseInsensitive)) if (!system.compare("minimal"_L1, Qt::CaseInsensitive))
return new QMinimalIntegration(paramList); return new QMinimalIntegration(paramList);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -58,7 +58,7 @@ static inline unsigned parseOptions(const QStringList &paramList)
} }
QMinimalIntegration::QMinimalIntegration(const QStringList &parameters) QMinimalIntegration::QMinimalIntegration(const QStringList &parameters)
: m_fontDatabase(0) : m_fontDatabase(nullptr)
, m_options(parseOptions(parameters)) , m_options(parseOptions(parameters))
{ {
if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable) if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable)

View File

@ -22,7 +22,7 @@ QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system
if (!system.compare("minimalegl"_L1, Qt::CaseInsensitive)) if (!system.compare("minimalegl"_L1, Qt::CaseInsensitive))
return new QMinimalEglIntegration; return new QMinimalEglIntegration;
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -11,7 +11,7 @@ QT_BEGIN_NAMESPACE
QMinimalEglBackingStore::QMinimalEglBackingStore(QWindow *window) QMinimalEglBackingStore::QMinimalEglBackingStore(QWindow *window)
: QPlatformBackingStore(window) : QPlatformBackingStore(window)
, m_context(new QOpenGLContext) , m_context(new QOpenGLContext)
, m_device(0) , m_device(nullptr)
{ {
m_context->setFormat(window->requestedFormat()); m_context->setFormat(window->requestedFormat());
m_context->setScreen(window->screen()); m_context->setScreen(window->screen());

View File

@ -41,8 +41,8 @@ public:
QMinimalEglScreen::QMinimalEglScreen(EGLNativeDisplayType display) QMinimalEglScreen::QMinimalEglScreen(EGLNativeDisplayType display)
: m_depth(32) : m_depth(32)
, m_format(QImage::Format_Invalid) , m_format(QImage::Format_Invalid)
, m_platformContext(0) , m_platformContext(nullptr)
, m_surface(0) , m_surface(nullptr)
{ {
#ifdef QEGL_EXTRA_DEBUG #ifdef QEGL_EXTRA_DEBUG
qWarning("QEglScreen %p\n", this); qWarning("QEglScreen %p\n", this);
@ -123,7 +123,7 @@ void QMinimalEglScreen::createAndSetPlatformContext()
q_printEglConfig(m_dpy, config); q_printEglConfig(m_dpy, config);
#endif #endif
m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL); m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, nullptr);
if (Q_UNLIKELY(m_surface == EGL_NO_SURFACE)) { if (Q_UNLIKELY(m_surface == EGL_NO_SURFACE)) {
qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError()); qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError());
eglTerminate(m_dpy); eglTerminate(m_dpy);
@ -132,7 +132,7 @@ void QMinimalEglScreen::createAndSetPlatformContext()
// qWarning("Created surface %dx%d\n", w, h); // qWarning("Created surface %dx%d\n", w, h);
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
QEGLPlatformContext *platformContext = new QMinimalEglContext(platformFormat, 0, m_dpy); QEGLPlatformContext *platformContext = new QMinimalEglContext(platformFormat, nullptr, m_dpy);
m_platformContext = platformContext; m_platformContext = platformContext;
#endif #endif
EGLint w,h; // screen size detection EGLint w,h; // screen size detection

View File

@ -189,7 +189,7 @@ QPixmap QOffscreenBackingStore::grabWindow(WId window, const QRect &rect) const
QOffscreenBackingStore *QOffscreenBackingStore::backingStoreForWinId(WId id) QOffscreenBackingStore *QOffscreenBackingStore::backingStoreForWinId(WId id)
{ {
return m_backingStoreForWinIdHash.value(id, 0); return m_backingStoreForWinIdHash.value(id, nullptr);
} }
void QOffscreenBackingStore::clearHash() void QOffscreenBackingStore::clearHash()

View File

@ -165,7 +165,7 @@ void QOffscreenWindow::setWindowState(Qt::WindowStates state)
QOffscreenWindow *QOffscreenWindow::windowForWinId(WId id) QOffscreenWindow *QOffscreenWindow::windowForWinId(WId id)
{ {
return m_windowForWinIdHash.value(id, 0); return m_windowForWinIdHash.value(id, nullptr);
} }
Q_CONSTINIT QHash<WId, QOffscreenWindow *> QOffscreenWindow::m_windowForWinIdHash; Q_CONSTINIT QHash<WId, QOffscreenWindow *> QOffscreenWindow::m_windowForWinIdHash;

View File

@ -21,7 +21,7 @@ QPlatformIntegration *QVkKhrDisplayIntegrationPlugin::create(const QString &syst
if (!system.compare("vkkhrdisplay"_L1, Qt::CaseInsensitive)) if (!system.compare("vkkhrdisplay"_L1, Qt::CaseInsensitive))
return new QVkKhrDisplayIntegration(paramList); return new QVkKhrDisplayIntegration(paramList);
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -141,12 +141,12 @@ void QXcbConnection::removeWindowEventListener(xcb_window_t id)
QXcbWindowEventListener *QXcbConnection::windowEventListenerFromId(xcb_window_t id) QXcbWindowEventListener *QXcbConnection::windowEventListenerFromId(xcb_window_t id)
{ {
return m_mapper.value(id, 0); return m_mapper.value(id, nullptr);
} }
QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id) QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id)
{ {
QXcbWindowEventListener *listener = m_mapper.value(id, 0); QXcbWindowEventListener *listener = m_mapper.value(id, nullptr);
if (listener) if (listener)
return listener->toWindow(); return listener->toWindow();
return nullptr; return nullptr;

View File

@ -158,7 +158,7 @@ void QSQLiteResultPrivate::finalize()
return; return;
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
stmt = 0; stmt = nullptr;
} }
void QSQLiteResultPrivate::initColumns(bool emptyResultset) void QSQLiteResultPrivate::initColumns(bool emptyResultset)
@ -765,7 +765,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
if (d->access) { if (d->access) {
sqlite3_close(d->access); sqlite3_close(d->access);
d->access = 0; d->access = nullptr;
} }
return false; return false;
@ -788,7 +788,7 @@ void QSQLiteDriver::close()
if (res != SQLITE_OK) if (res != SQLITE_OK)
setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError, res)); setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError, res));
d->access = 0; d->access = nullptr;
setOpen(false); setOpen(false);
setOpenError(false); setOpenError(false);
} }

View File

@ -31,7 +31,8 @@ QSqlDriver* QSQLiteDriverPlugin::create(const QString &name)
QSQLiteDriver* driver = new QSQLiteDriver(); QSQLiteDriver* driver = new QSQLiteDriver();
return driver; return driver;
} }
return 0;
return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE