Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Use nullptr

parent 8eac9721
......@@ -150,7 +150,7 @@ void testWaylandBackend::verifyOutputs()
QVERIFY(output->geometry() != QRectF(1,1,1,1));
QVERIFY(output->geometry() != QRectF());
QVERIFY(output->sizeMm() != QSize());
QVERIFY(output->edid() != 0);
QVERIFY(output->edid() != nullptr);
QVERIFY(output->preferredModes().size() == 1);
QCOMPARE(output->rotation(), Output::None);
QVERIFY(!ids.contains(output->id()));
......
......@@ -135,7 +135,7 @@ void testQScreenBackend::verifyOutputs()
QEXPECT_FAIL("", "The X server doesn't return a sensible physical output size", Continue);
QVERIFY(output->sizeMm() != QSize());
}
QVERIFY(output->edid() != 0);
QVERIFY(output->edid() != nullptr);
QCOMPARE(output->rotation(), Output::None);
QVERIFY(!ids.contains(output->id()));
ids << output->id();
......
......@@ -91,6 +91,6 @@ bool WaylandBackend::isValid() const
void WaylandBackend::updateConfig(ConfigPtr &config)
{
Q_ASSERT(config != 0);
Q_ASSERT(config != nullptr);
m_internalConfig->updateKScreenConfig(config);
}
......@@ -26,13 +26,13 @@ using namespace KScreen;
Q_LOGGING_CATEGORY(KSCREEN_QSCREEN, "kscreen.qscreen")
QScreenConfig *QScreenBackend::s_internalConfig = 0;
QScreenConfig *QScreenBackend::s_internalConfig = nullptr;
QScreenBackend::QScreenBackend()
: KScreen::AbstractBackend()
, m_isValid(true)
{
if (s_internalConfig == 0) {
if (s_internalConfig == nullptr) {
s_internalConfig = new QScreenConfig();
connect(s_internalConfig, &QScreenConfig::configChanged,
this, &QScreenBackend::configChanged);
......
......@@ -34,7 +34,7 @@ class QScreenConfig : public QObject
Q_OBJECT
public:
explicit QScreenConfig(QObject *parent = 0);
explicit QScreenConfig(QObject *parent = nullptr);
virtual ~QScreenConfig();
KScreen::ConfigPtr toKScreenConfig() const;
......
......@@ -30,7 +30,7 @@ using namespace KScreen;
QScreenOutput::QScreenOutput(const QScreen *qscreen, QObject *parent)
: QObject(parent)
, m_qscreen(qscreen)
, m_edid(0)
, m_edid(nullptr)
, m_id(-1)
{
}
......
......@@ -36,7 +36,7 @@ class QScreenOutput : public QObject
Q_OBJECT
public:
explicit QScreenOutput(const QScreen *qscreen, QObject *parent = 0);
explicit QScreenOutput(const QScreen *qscreen, QObject *parent = nullptr);
virtual ~QScreenOutput();
KScreen::OutputPtr toKScreenOutput() const;
......
......@@ -54,7 +54,7 @@ XCBEventListener::XCBEventListener():
m_randrErrorBase = queryExtension->first_error;
m_majorOpcode = queryExtension->major_opcode;
xcb_generic_error_t *error = NULL;
xcb_generic_error_t *error = nullptr;
auto* versionReply = xcb_randr_query_version_reply(c, cookie, &error);
Q_ASSERT_X(versionReply, "xrandrxcbhelper", "Query to fetch xrandr version failed");
if (error) {
......@@ -73,7 +73,7 @@ XCBEventListener::XCBEventListener():
xcb_create_window(c, XCB_COPY_FROM_PARENT, m_window,
rWindow,
0, 0, 1, 1, 0, XCB_COPY_FROM_PARENT,
XCB_COPY_FROM_PARENT, 0, NULL);
XCB_COPY_FROM_PARENT, 0, nullptr);
xcb_randr_select_input(c, m_window,
XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE |
......@@ -201,7 +201,7 @@ void XCBEventListener::handleXRandRNotify(xcb_generic_event_t* e)
xcb_randr_output_property_t property = randrEvent->u.op;
XCB::ScopedPointer<xcb_get_atom_name_reply_t> reply(xcb_get_atom_name_reply(QX11Info::connection(),
xcb_get_atom_name(QX11Info::connection(), property.atom), NULL));
xcb_get_atom_name(QX11Info::connection(), property.atom), nullptr));
qCDebug(KSCREEN_XCB_HELPER) << "RRNotify_OutputProperty (ignored)";
qCDebug(KSCREEN_XCB_HELPER) << "\tOutput: " << property.output;
......
......@@ -21,14 +21,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "xcbwrapper.h"
static xcb_connection_t *sXRandR11XCBConnection = 0;
static xcb_connection_t *sXRandR11XCBConnection = nullptr;
xcb_connection_t* XCB::connection()
{
// Use our own connection to make sure that we won't mess up Qt's connection
// if something goes wrong on our side.
if (sXRandR11XCBConnection == 0) {
sXRandR11XCBConnection = xcb_connect(0, 0);
if (sXRandR11XCBConnection == nullptr) {
sXRandR11XCBConnection = xcb_connect(nullptr, nullptr);
}
return sXRandR11XCBConnection;
}
......@@ -37,7 +37,7 @@ void XCB::closeConnection()
{
if (sXRandR11XCBConnection) {
xcb_disconnect(sXRandR11XCBConnection);
sXRandR11XCBConnection = 0;
sXRandR11XCBConnection = nullptr;
}
}
......
......@@ -60,7 +60,7 @@ public:
Wrapper()
: m_retrieved(false)
, m_window(XCB_WINDOW_NONE)
, m_reply(Q_NULLPTR)
, m_reply(nullptr)
{
m_cookie.sequence = 0;
}
......@@ -68,14 +68,14 @@ public:
: m_retrieved(false)
, m_cookie(requestFunc(connection(), args ...))
, m_window(requestWindow<RequestFuncArgs ...>(args ...))
, m_reply(Q_NULLPTR)
, m_reply(nullptr)
{
}
explicit Wrapper(const Wrapper &other)
: m_retrieved(other.m_retrieved)
, m_cookie(other.m_cookie)
, m_window(other.m_window)
, m_reply(Q_NULLPTR)
, m_reply(nullptr)
{
takeFromOther(const_cast<Wrapper&>(other));
}
......@@ -107,7 +107,7 @@ public:
}
inline bool isNull() const {
getReply();
return m_reply == NULL;
return m_reply == nullptr;
}
inline operator bool() const {
return !isNull();
......@@ -132,7 +132,7 @@ public:
inline Reply *take() {
getReply();
Reply *ret = m_reply;
m_reply = Q_NULLPTR;
m_reply = nullptr;
m_window = XCB_WINDOW_NONE;
return ret;
}
......@@ -142,7 +142,7 @@ protected:
if (m_retrieved || !m_cookie.sequence) {
return;
}
m_reply = replyFunc(connection(), m_cookie, NULL);
m_reply = replyFunc(connection(), m_cookie, nullptr);
m_retrieved = true;
}
......
......@@ -36,9 +36,9 @@
#include <QX11Info>
#include <QGuiApplication>
xcb_screen_t* XRandR::s_screen = 0;
xcb_screen_t* XRandR::s_screen = nullptr;
xcb_window_t XRandR::s_rootWindow = 0;
XRandRConfig* XRandR::s_internalConfig = 0;
XRandRConfig* XRandR::s_internalConfig = nullptr;
int XRandR::s_randrBase = 0;
int XRandR::s_randrError = 0;
bool XRandR::s_monitorInitialized = false;
......@@ -51,9 +51,9 @@ Q_LOGGING_CATEGORY(KSCREEN_XRANDR, "kscreen.xrandr")
XRandR::XRandR()
: KScreen::AbstractBackend()
, m_x11Helper(0)
, m_x11Helper(nullptr)
, m_isValid(false)
, m_configChangeCompressor(0)
, m_configChangeCompressor(nullptr)
{
qRegisterMetaType<xcb_randr_output_t>("xcb_randr_output_t");
qRegisterMetaType<xcb_randr_crtc_t>("xcb_randr_crtc_t");
......@@ -63,7 +63,7 @@ XRandR::XRandR()
// Use our own connection to make sure that we won't mess up Qt's connection
// if something goes wrong on our side.
xcb_generic_error_t *error = 0;
xcb_generic_error_t *error = nullptr;
xcb_randr_query_version_reply_t* version;
XCB::connection();
version = xcb_randr_query_version_reply(XCB::connection(), xcb_randr_query_version(XCB::connection(), XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION), &error);
......@@ -82,7 +82,7 @@ XRandR::XRandR()
return;
}
if (s_screen == 0) {
if (s_screen == nullptr) {
s_screen = XCB::screenOfDisplay(XCB::connection(), QX11Info::appScreen());
s_rootWindow = s_screen->root;
......@@ -94,7 +94,7 @@ XRandR::XRandR()
XRandR::s_has_1_3 = (version->major_version > 1 || (version->major_version == 1 && version->minor_version >= 3));
if (s_internalConfig == 0) {
if (s_internalConfig == nullptr) {
s_internalConfig = new XRandRConfig();
}
......@@ -238,7 +238,7 @@ quint8* XRandR::getXProperty(xcb_randr_output_t output, xcb_atom_t atom, size_t
auto cookie = xcb_randr_get_output_property(XCB::connection(), output, atom,
XCB_ATOM_ANY,
0, 100, false, false);
auto reply = xcb_randr_get_output_property_reply(XCB::connection(), cookie, NULL);
auto reply = xcb_randr_get_output_property_reply(XCB::connection(), cookie, nullptr);
if (reply->type == XCB_ATOM_INTEGER && reply->format == 8) {
result = new quint8[reply->num_items];
memcpy(result, xcb_randr_get_output_property_data(reply), reply->num_items);
......@@ -257,11 +257,11 @@ quint8 *XRandR::outputEdid(xcb_randr_output_t outputId, size_t &len)
auto edid_atom = XCB::InternAtom(false, 4, "EDID")->atom;
result = XRandR::getXProperty(outputId, edid_atom, len);
if (result == NULL) {
if (result == nullptr) {
auto edid_atom = XCB::InternAtom(false, 9, "EDID_DATA")->atom;
result = XRandR::getXProperty(outputId, edid_atom, len);
}
if (result == NULL) {
if (result == nullptr) {
auto edid_atom = XCB::InternAtom(false, 25, "XFree86_DDC_EDID1_RAWDATA")->atom;
result = XRandR::getXProperty(outputId, edid_atom, len);
}
......@@ -275,7 +275,7 @@ quint8 *XRandR::outputEdid(xcb_randr_output_t outputId, size_t &len)
}
}
return 0;
return nullptr;
}
xcb_randr_get_screen_resources_reply_t* XRandR::screenResources()
......@@ -287,7 +287,7 @@ xcb_randr_get_screen_resources_reply_t* XRandR::screenResources()
return reinterpret_cast<xcb_randr_get_screen_resources_reply_t*>(
xcb_randr_get_screen_resources_current_reply(XCB::connection(),
xcb_randr_get_screen_resources_current(XCB::connection(), XRandR::rootWindow()),
NULL));
nullptr));
} else {
/* XRRGetScreenResourcesCurrent is faster then XRRGetScreenResources
* because it returns cached values. However the cached values are not
......@@ -298,7 +298,7 @@ xcb_randr_get_screen_resources_reply_t* XRandR::screenResources()
}
return xcb_randr_get_screen_resources_reply(XCB::connection(),
xcb_randr_get_screen_resources(XCB::connection(), XRandR::rootWindow()), NULL);
xcb_randr_get_screen_resources(XCB::connection(), XRandR::rootWindow()), nullptr);
}
xcb_window_t XRandR::rootWindow()
......
......@@ -474,8 +474,8 @@ bool XRandRConfig::disableOutput(const OutputPtr &kscreenOutput) const
0, 0,
XCB_NONE,
XCB_RANDR_ROTATION_ROTATE_0,
0, NULL);
XCB::ScopedPointer<xcb_randr_set_crtc_config_reply_t> reply(xcb_randr_set_crtc_config_reply(XCB::connection(), cookie, NULL));
0, nullptr);
XCB::ScopedPointer<xcb_randr_set_crtc_config_reply_t> reply(xcb_randr_set_crtc_config_reply(XCB::connection(), cookie, nullptr));
if (!reply) {
qCDebug(KSCREEN_XRANDR) << "\tResult: unknown (error)";
return false;
......@@ -530,7 +530,7 @@ bool XRandRConfig::enableOutput(const OutputPtr &kscreenOutput) const
modeId,
kscreenOutput->rotation(),
1, outputs);
XCB::ScopedPointer<xcb_randr_set_crtc_config_reply_t> reply(xcb_randr_set_crtc_config_reply(XCB::connection(), cookie, NULL));
XCB::ScopedPointer<xcb_randr_set_crtc_config_reply_t> reply(xcb_randr_set_crtc_config_reply(XCB::connection(), cookie, nullptr));
if (!reply) {
qCDebug(KSCREEN_XRANDR) << "Result: unknown (error)";
return false;
......@@ -571,7 +571,7 @@ bool XRandRConfig::changeOutput(const OutputPtr &kscreenOutput) const
modeId,
kscreenOutput->rotation(),
1, outputs);
XCB::ScopedPointer<xcb_randr_set_crtc_config_reply_t> reply(xcb_randr_set_crtc_config_reply(XCB::connection(), cookie, NULL));
XCB::ScopedPointer<xcb_randr_set_crtc_config_reply_t> reply(xcb_randr_set_crtc_config_reply(XCB::connection(), cookie, nullptr));
if (!reply) {
qCDebug(KSCREEN_XRANDR) << "\tResult: unknown (error)";
return false;
......
......@@ -35,7 +35,7 @@ XRandROutput::XRandROutput(xcb_randr_output_t id, XRandRConfig *config)
, m_id(id)
, m_type(KScreen::Output::Unknown)
, m_primary(0)
, m_crtc(0)
, m_crtc(nullptr)
{
init();
}
......@@ -91,7 +91,7 @@ XRandRMode* XRandROutput::currentMode() const
}
int modeId = m_crtc->mode();
if (!m_modes.contains(modeId)) {
return 0;
return nullptr;
}
return m_modes[modeId];
......@@ -174,7 +174,7 @@ void XRandROutput::update(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_rand
if (crtc == XCB_NONE && mode == XCB_NONE) {
// Monitor has been disabled
m_crtc->disconectOutput(m_id);
m_crtc = 0;
m_crtc = nullptr;
} else {
m_crtc = m_config->crtc(crtc);
m_crtc->connectOutput(m_id);
......@@ -276,7 +276,7 @@ QByteArray XRandROutput::typeFromProperty(xcb_randr_output_t outputId)
auto cookie = xcb_randr_get_output_property(XCB::connection(), outputId, atomType->atom,
XCB_ATOM_ANY, 0, 100, false, false);
XCB::ScopedPointer<xcb_randr_get_output_property_reply_t> reply(xcb_randr_get_output_property_reply(XCB::connection(), cookie, NULL));
XCB::ScopedPointer<xcb_randr_get_output_property_reply_t> reply(xcb_randr_get_output_property_reply(XCB::connection(), cookie, nullptr));
if (!reply) {
return type;
}
......
......@@ -36,7 +36,7 @@ class XRandRScreen : public QObject
Q_OBJECT
public:
explicit XRandRScreen(XRandRConfig *config = 0);
explicit XRandRScreen(XRandRConfig *config = nullptr);
virtual ~XRandRScreen();
KScreen::ScreenPtr toKScreenScreen() const;
......
......@@ -34,11 +34,11 @@ Q_LOGGING_CATEGORY(KSCREEN_XRANDR11, "kscreen.xrandr11")
XRandR11::XRandR11()
: KScreen::AbstractBackend()
, m_valid(false)
, m_x11Helper(0)
, m_x11Helper(nullptr)
, m_currentConfig(new KScreen::Config)
, m_currentTimestamp(0)
{
xcb_generic_error_t *error = 0;
xcb_generic_error_t *error = nullptr;
xcb_randr_query_version_reply_t* version;
version = xcb_randr_query_version_reply(XCB::connection(),
xcb_randr_query_version(XCB::connection(), XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION), &error);
......
......@@ -62,11 +62,11 @@ BackendManager *BackendManager::instance()
BackendManager::BackendManager()
: QObject()
, mInterface(0)
, mInterface(nullptr)
, mCrashCount(0)
, mShuttingDown(false)
, mRequestsCounter(0)
, mLoader(0)
, mLoader(nullptr)
, mMethod(OutOfProcess)
{
Log::instance();
......@@ -377,7 +377,7 @@ void BackendManager::invalidateInterface()
{
Q_ASSERT(mMethod == OutOfProcess);
delete mInterface;
mInterface = 0;
mInterface = nullptr;
mBackendService.clear();
}
......
......@@ -54,7 +54,7 @@ Q_SIGNALS:
void finished(ConfigOperation *operation);
protected:
explicit ConfigOperation(ConfigOperationPrivate *dd, QObject *parent = 0);
explicit ConfigOperation(ConfigOperationPrivate *dd, QObject *parent = nullptr);
void setError(const QString &error);
void emitResult();
......
......@@ -41,7 +41,7 @@ class Q_DECL_HIDDEN Output::Private
connected(false),
enabled(false),
primary(false),
edid(0)
edid(nullptr)
{}
Private(const Private &other):
......@@ -142,14 +142,14 @@ QString Output::Private::biggestMode(const ModeList& modes) const
}
if (!biggest) {
return 0;
return nullptr;
}
return biggest->id();
}
Output::Output()
: QObject(0)
: QObject(nullptr)
, d(new Private())
{
......@@ -460,7 +460,7 @@ void Output::setClones(QList<int> outputlist)
void Output::setEdid(const QByteArray& rawData)
{
Q_ASSERT(d->edid == 0);
Q_ASSERT(d->edid == nullptr);
d->edid = new Edid(rawData);
}
......
......@@ -46,7 +46,7 @@ class Q_DECL_HIDDEN Screen::Private
};
Screen::Screen()
: QObject(0)
: QObject(nullptr)
, d(new Private())
{
}
......
......@@ -45,7 +45,7 @@ class WaylandTestServer : public QObject
Q_OBJECT
public:
explicit WaylandTestServer(QObject *parent = 0);
explicit WaylandTestServer(QObject *parent = nullptr);
virtual ~WaylandTestServer();
void setConfig(const QString &configfile);
......
......@@ -35,7 +35,7 @@ class TestPnp : public QObject
Q_OBJECT
public:
explicit TestPnp(bool monitor, QObject *parent = 0);
explicit TestPnp(bool monitor, QObject *parent = nullptr);
virtual ~TestPnp();
private Q_SLOTS:
......
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