Commit 7c602a83 authored by Laurent Montel's avatar Laurent Montel 😁

Use nullptr. Initialize pointer

Test Plan: compile

Reviewers: davidedmundson, sebas

Reviewed By: sebas

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8432
parent 1c62a826
......@@ -51,7 +51,7 @@ xcb_screen_t* XCB::screenOfDisplay(xcb_connection_t* c, int screen)
}
}
return Q_NULLPTR;
return nullptr;
}
......
......@@ -37,7 +37,7 @@ using namespace KScreen;
XRandRConfig::XRandRConfig()
: QObject()
, m_screen(Q_NULLPTR)
, m_screen(nullptr)
{
m_screen = new XRandRScreen(this);
......@@ -495,7 +495,7 @@ bool XRandRConfig::enableOutput(const OutputPtr &kscreenOutput) const
{
xcb_randr_output_t outputs[1] { static_cast<xcb_randr_output_t>(kscreenOutput->id()) };
XRandRCrtc *freeCrtc = Q_NULLPTR;
XRandRCrtc *freeCrtc = nullptr;
qCDebug(KSCREEN_XRANDR) << m_crtcs;
Q_FOREACH (XRandRCrtc *crtc, m_crtcs) {
crtc->update();
......
......@@ -55,7 +55,7 @@ bool XRandROutput::isConnected() const
bool XRandROutput::isEnabled() const
{
return m_crtc != Q_NULLPTR && m_crtc->mode() != XCB_NONE;
return m_crtc != nullptr && m_crtc->mode() != XCB_NONE;
}
bool XRandROutput::isPrimary() const
......@@ -86,7 +86,7 @@ QString XRandROutput::currentModeId() const
XRandRMode* XRandROutput::currentMode() const
{
if (!m_crtc) {
return Q_NULLPTR;
return nullptr;
}
int modeId = m_crtc->mode();
if (!m_modes.contains(modeId)) {
......@@ -168,7 +168,7 @@ void XRandROutput::update(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_rand
// crtc->mode may already be unset due to xcb_randr_crtc_tChangeNotify coming before
// xcb_randr_output_tChangeNotify and reseting the CRTC mode
if ((m_crtc == Q_NULLPTR) != (crtc == XCB_NONE)) {
if ((m_crtc == nullptr) != (crtc == XCB_NONE)) {
if (crtc == XCB_NONE && mode == XCB_NONE) {
// Monitor has been disabled
m_crtc->disconectOutput(m_id);
......
......@@ -56,7 +56,7 @@ private Q_SLOTS:
private:
KScreen::AbstractBackend *mBackend;
KScreen::AbstractBackend *mBackend = nullptr;
QTimer mChangeCollector;
KScreen::ConfigPtr mCurrentConfig;
......
......@@ -47,8 +47,8 @@ void pluginDeleter(QPluginLoader *p)
BackendLoader::BackendLoader()
: QObject()
, QDBusContext()
, mLoader(Q_NULLPTR)
, mBackend(Q_NULLPTR)
, mLoader(nullptr)
, mBackend(nullptr)
{
}
......@@ -104,9 +104,9 @@ bool BackendLoader::requestBackend(const QString &backendName, const QVariantMap
mBackend = new BackendDBusWrapper(backend);
if (!mBackend->init()) {
delete mBackend;
mBackend = Q_NULLPTR;
mBackend = nullptr;
pluginDeleter(mLoader);
mLoader = Q_NULLPTR;
mLoader = nullptr;
return false;
}
return true;
......@@ -115,7 +115,7 @@ bool BackendLoader::requestBackend(const QString &backendName, const QVariantMap
KScreen::AbstractBackend *BackendLoader::loadBackend(const QString &name,
const QVariantMap &arguments)
{
if (mLoader == Q_NULLPTR) {
if (mLoader == nullptr) {
std::unique_ptr<QPluginLoader, void(*)(QPluginLoader *)> loader(new QPluginLoader(), pluginDeleter);
mLoader = loader.release();
}
......
......@@ -51,8 +51,8 @@ private:
KScreen::AbstractBackend *loadBackend(const QString &name, const QVariantMap &arguments);
private:
QPluginLoader *mLoader;
BackendDBusWrapper *mBackend;
QPluginLoader *mLoader = nullptr;
BackendDBusWrapper *mBackend = nullptr;
};
#endif // BACKENDLAUNCHER_H
......@@ -49,7 +49,7 @@ Q_DECLARE_METATYPE(org::kde::kscreen::Backend*)
const int BackendManager::sMaxCrashCount = 4;
BackendManager *BackendManager::sInstance = 0;
BackendManager *BackendManager::sInstance = nullptr;
BackendManager *BackendManager::instance()
{
......@@ -216,7 +216,7 @@ KScreen::AbstractBackend *BackendManager::loadBackendPlugin(QPluginLoader *loade
qCDebug(KSCREEN) << finfo.fileName() << "does not provide valid KScreen backend";
}
return Q_NULLPTR;
return nullptr;
}
KScreen::AbstractBackend *BackendManager::loadBackendInProcess(const QString &name)
......
......@@ -198,7 +198,7 @@ bool Config::canBeApplied(const ConfigPtr &config, ValidityFlags flags)
}
Config::Config()
: QObject(0)
: QObject(nullptr)
, d(new Private(this))
{
}
......
......@@ -195,9 +195,9 @@ void ConfigMonitor::Private::configDestroyed(QObject *removedConfig)
ConfigMonitor *ConfigMonitor::instance()
{
static ConfigMonitor *s_instance = Q_NULLPTR;
static ConfigMonitor *s_instance = nullptr;
if (s_instance == 0) {
if (s_instance == nullptr) {
s_instance = new ConfigMonitor();
}
......
......@@ -34,7 +34,7 @@ class Doctor : public QObject
Q_OBJECT
public:
explicit Doctor(QObject *parent = 0);
explicit Doctor(QObject *parent = nullptr);
virtual ~Doctor();
void setOptionList(const QStringList &positionalArgs);
......
......@@ -44,7 +44,7 @@ class DpmsClient : public QObject
Q_OBJECT
public:
explicit DpmsClient(QObject *parent = 0);
explicit DpmsClient(QObject *parent = nullptr);
virtual ~DpmsClient();
void connect();
......@@ -62,8 +62,8 @@ private Q_SLOTS:
private:
void changeMode(KWayland::Client::Dpms::Mode mode);
QThread *m_thread;
KWayland::Client::ConnectionThread *m_connection;
KWayland::Client::DpmsManager *m_dpmsManager;
KWayland::Client::ConnectionThread *m_connection = nullptr;
KWayland::Client::DpmsManager *m_dpmsManager = nullptr;
KWayland::Client::Registry m_registry;
bool m_setOff = true;
bool m_setOn = false;
......
......@@ -50,7 +50,7 @@ class KSCREEN_EXPORT Edid: public QObject
public:
explicit Edid();
explicit Edid(const QByteArray &data, QObject *parent = 0);
explicit Edid(const QByteArray &data, QObject *parent = nullptr);
virtual ~Edid();
Edid* clone() const;
......
......@@ -37,7 +37,7 @@ class KSCREEN_EXPORT GetConfigOperation : public KScreen::ConfigOperation
public:
explicit GetConfigOperation(Options options = NoOptions, QObject* parent = 0);
explicit GetConfigOperation(Options options = NoOptions, QObject* parent = nullptr);
virtual ~GetConfigOperation();
virtual KScreen::ConfigPtr config() const Q_DECL_OVERRIDE;
......
......@@ -42,7 +42,7 @@ class Mode::Private
};
Mode::Mode()
: QObject(0)
: QObject(nullptr)
, d(new Private())
{
......
......@@ -32,7 +32,7 @@ class KSCREEN_EXPORT SetConfigOperation : public KScreen::ConfigOperation
{
Q_OBJECT
public:
explicit SetConfigOperation(const KScreen::ConfigPtr &config, QObject* parent = 0);
explicit SetConfigOperation(const KScreen::ConfigPtr &config, QObject* parent = nullptr);
~SetConfigOperation();
KScreen::ConfigPtr config() const Q_DECL_OVERRIDE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment