Commit 83cabac4 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use nullptr

parent 3b1a928a
......@@ -130,7 +130,7 @@ void SuspendSession::triggerImpl(const QVariantMap &args)
}
// Switch for real action
KJob *suspendJob = 0;
KJob *suspendJob = nullptr;
switch ((Mode) (args["Type"].toUInt())) {
case ToRamMode:
Q_EMIT aboutToSuspend();
......
......@@ -36,7 +36,7 @@
#include <sys/types.h>
#include <sys/sysctl.h>
#define HAS_SYSCTL(n) (sysctlbyname(n, NULL, NULL, NULL, 0) == 0)
#define HAS_SYSCTL(n) (sysctlbyname(n, nullptr, nullptr, nullptr, 0) == 0)
#endif
#define BACKLIGHT_SYSFS_PATH "/sys/class/backlight/"
......@@ -154,7 +154,7 @@ void BacklightHelper::initUsingSysctl()
}
size_t len;
if (sysctlbyname(qPrintable(QStringLiteral("hw.acpi.video.%1.levels").arg(m_sysctlDevice)), NULL, &len, NULL, 0) != 0 ||
if (sysctlbyname(qPrintable(QStringLiteral("hw.acpi.video.%1.levels").arg(m_sysctlDevice)), nullptr, &len, nullptr, 0) != 0 ||
len == 0) {
return;
}
......@@ -162,7 +162,7 @@ void BacklightHelper::initUsingSysctl()
if (!levels) {
return;
}
if (sysctlbyname(qPrintable(QString("hw.acpi.video.%1.levels").arg(m_sysctlDevice)), levels, &len, NULL, 0) != 0) {
if (sysctlbyname(qPrintable(QString("hw.acpi.video.%1.levels").arg(m_sysctlDevice)), levels, &len, nullptr, 0) != 0) {
free(levels);
return;
}
......@@ -193,7 +193,7 @@ ActionReply BacklightHelper::brightness(const QVariantMap &args)
#ifdef USE_SYSCTL
size_t len = sizeof(int);
if (sysctlbyname(qPrintable(QStringLiteral("hw.acpi.video.%1.brightness").arg(m_sysctlDevice)), &brightness, &len, NULL, 0) != 0) {
if (sysctlbyname(qPrintable(QStringLiteral("hw.acpi.video.%1.brightness").arg(m_sysctlDevice)), &brightness, &len, nullptr, 0) != 0) {
reply = ActionReply::HelperErrorReply();
return reply;
}
......@@ -251,7 +251,7 @@ ActionReply BacklightHelper::setbrightness(const QVariantMap &args)
d1 = d2;
}
size_t len = sizeof(int);
if (sysctlbyname(qPrintable(QStringLiteral("hw.acpi.video.%1.brightness").arg(m_sysctlDevice)), NULL, NULL, &actual_level, len) != 0) {
if (sysctlbyname(qPrintable(QStringLiteral("hw.acpi.video.%1.brightness").arg(m_sysctlDevice)), nullptr, nullptr, &actual_level, len) != 0) {
reply = ActionReply::HelperErrorReply();
return reply;
}
......
......@@ -47,11 +47,11 @@
PowerDevilUPowerBackend::PowerDevilUPowerBackend(QObject* parent)
: BackendInterface(parent)
, m_displayDevice(Q_NULLPTR)
, m_brightnessControl(Q_NULLPTR)
, m_randrHelper(Q_NULLPTR)
, m_upowerInterface(Q_NULLPTR)
, m_kbdBacklight(Q_NULLPTR)
, m_displayDevice(nullptr)
, m_brightnessControl(nullptr)
, m_randrHelper(nullptr)
, m_upowerInterface(nullptr)
, m_kbdBacklight(nullptr)
, m_kbdMaxBrightness(0)
, m_lidIsPresent(false)
, m_lidIsClosed(false)
......
......@@ -29,7 +29,7 @@
namespace UdevQt {
ClientPrivate::ClientPrivate(Client *q_)
: udev(0), monitor(0), q(q_), monitorNotifier(0)
: udev(nullptr), monitor(nullptr), q(q_), monitorNotifier(nullptr)
{
}
......@@ -70,7 +70,7 @@ void ClientPrivate::setWatchedSubsystems(const QStringList &subsystemList)
QByteArray devType = subsysDevtype.midRef(ix + 1).toLatin1();
udev_monitor_filter_add_match_subsystem_devtype(newM, subsystem.constData(), devType.constData());
} else {
udev_monitor_filter_add_match_subsystem_devtype(newM, subsysDevtype.toLatin1().constData(), NULL);
udev_monitor_filter_add_match_subsystem_devtype(newM, subsysDevtype.toLatin1().constData(), nullptr);
}
}
......@@ -191,7 +191,7 @@ DeviceList Client::devicesByProperty(const QString &property, const QVariant &va
if (value.isValid()) {
udev_enumerate_add_match_property(en, property.toLatin1().constData(), value.toString().toLatin1().constData());
} else {
udev_enumerate_add_match_property(en, property.toLatin1().constData(), NULL);
udev_enumerate_add_match_property(en, property.toLatin1().constData(), nullptr);
}
return d->deviceListFromEnumerate(en);
......@@ -218,7 +218,7 @@ Device Client::deviceByDeviceFile(const QString &deviceFile)
if (QT_STAT(deviceFile.toLatin1().constData(), &sb) != 0)
return Device();
struct udev_device *ud = 0;
struct udev_device *ud = nullptr;
if (S_ISBLK(sb.st_mode))
ud = udev_device_new_from_devnum(d->udev, 'b', sb.st_rdev);
......
......@@ -40,8 +40,8 @@ class Client : public QObject
Q_PROPERTY(QStringList watchedSubsystems READ watchedSubsystems WRITE setWatchedSubsystems)
public:
explicit Client(QObject *parent = 0);
explicit Client(const QStringList &subsystemList, QObject *parent = 0);
explicit Client(QObject *parent = nullptr);
explicit Client(const QStringList &subsystemList, QObject *parent = nullptr);
~Client();
QStringList watchedSubsystems() const;
......
......@@ -74,7 +74,7 @@ QString DevicePrivate::decodePropertyValue(const QByteArray &encoded) const
}
Device::Device()
: d(0)
: d(nullptr)
{
}
......@@ -83,7 +83,7 @@ Device::Device(const Device &other)
if (other.d) {
d = new DevicePrivate(other.d->udev);
} else {
d = 0;
d = nullptr;
}
}
......@@ -103,7 +103,7 @@ Device &Device::operator=(const Device &other)
return *this;
if (!other.d) {
delete d;
d = 0;
d = nullptr;
return *this;
}
if (!d) {
......@@ -117,7 +117,7 @@ Device &Device::operator=(const Device &other)
bool Device::isValid() const
{
return (d != 0);
return (d != nullptr);
}
QString Device::subsystem() const
......
......@@ -101,7 +101,7 @@ void XRandRXCBHelper::init()
// QByteArray backlightCaps("BACKLIGHT");
// xcb_intern_atom(c, true, backlightCaps.length(), backlightCaps.constData());
xcb_intern_atom_reply_t* atomReply =
xcb_intern_atom_reply(c, xcb_intern_atom(c, true, backlight.length(), backlight.constData()), NULL);
xcb_intern_atom_reply(c, xcb_intern_atom(c, true, backlight.length(), backlight.constData()), nullptr);
//If backlight atom doesn't exist, means that no driver is actually supporting it
if (!atomReply) {
......@@ -115,7 +115,7 @@ void XRandRXCBHelper::init()
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_OUTPUT_PROPERTY);
qApp->installNativeEventFilter(this);
......
......@@ -43,11 +43,11 @@ class XRandRXCBHelper : public QObject, public QAbstractNativeEventFilter
public:
static inline XRandRXCBHelper* self()
{
static XRandRXCBHelper* s_instance = 0;
static XRandRXCBHelper* s_instance = nullptr;
if (!s_instance) {
s_instance = new XRandRXCBHelper();
if (!s_instance->isValid()) {
s_instance = 0;
s_instance = nullptr;
}
}
......@@ -71,7 +71,7 @@ private:
inline xcb_connection_t *conn()
{
static xcb_connection_t *s_con = NULL;
static xcb_connection_t *s_con = nullptr;
if (!s_con) {
s_con = QX11Info::connection();
}
......
......@@ -72,10 +72,10 @@ bool KWinKScreenHelperEffect::checkValid()
if (QX11Info::isPlatformX11()) {
QScopedPointer<xcb_list_properties_reply_t, QScopedPointerPodDeleter> propsReply(xcb_list_properties_reply(QX11Info::connection(),
xcb_list_properties_unchecked(QX11Info::connection(), QX11Info::appRootWindow()),
NULL));
nullptr));
QScopedPointer<xcb_intern_atom_reply_t, QScopedPointerPodDeleter> atomReply(xcb_intern_atom_reply(QX11Info::connection(),
xcb_intern_atom_unchecked(QX11Info::connection(), false, 25, "_KDE_KWIN_KSCREEN_SUPPORT"),
NULL));
nullptr));
if (propsReply.isNull() || atomReply.isNull()) {
return false;
......@@ -127,7 +127,7 @@ bool KWinKScreenHelperEffect::nativeEventFilter(const QByteArray &eventType, voi
}
auto cookie = xcb_get_property(QX11Info::connection(), false, QX11Info::appRootWindow(), m_atom, XCB_ATOM_CARDINAL, 0, 1);
QScopedPointer<xcb_get_property_reply_t, QScopedPointerPodDeleter> reply(xcb_get_property_reply(QX11Info::connection(), cookie, NULL));
QScopedPointer<xcb_get_property_reply_t, QScopedPointerPodDeleter> reply(xcb_get_property_reply(QX11Info::connection(), cookie, nullptr));
if (reply.isNull() || reply.data()->value_len != 1 || reply.data()->format != uint8_t(32)) {
return false;
}
......
......@@ -50,7 +50,7 @@ namespace PowerDevil
class ActionPoolHelper
{
public:
ActionPoolHelper() : q(0) {}
ActionPoolHelper() : q(nullptr) {}
~ActionPoolHelper() {
delete q;
}
......@@ -184,7 +184,7 @@ Action* ActionPool::loadAction(const QString& actionId, const KConfigGroup& grou
return retaction;
} else {
// Hmm... troubles in configuration. Np, let's just return 0 and let the core handle this
return 0;
return nullptr;
}
}
......
......@@ -44,7 +44,7 @@
PowerDevilApp::PowerDevilApp(int &argc, char **argv)
: QGuiApplication(argc, argv)
, m_core(Q_NULLPTR)
, m_core(nullptr)
{
migratePre512KeyboardShortcuts();
}
......@@ -105,7 +105,7 @@ void PowerDevilApp::init()
if (!instance) {
qCDebug(POWERDEVIL) << loader->errorString();
qCCritical(POWERDEVIL) << "KDE Power Management System init failed!";
m_core->loadCore(0);
m_core->loadCore(nullptr);
return;
}
......@@ -113,7 +113,7 @@ void PowerDevilApp::init()
if (!interface) {
qCDebug(POWERDEVIL) << "Failed to cast plugin instance to BackendInterface, check your plugin";
qCCritical(POWERDEVIL) << "KDE Power Management System init failed!";
m_core->loadCore(0);
m_core->loadCore(nullptr);
return;
}
......
......@@ -36,7 +36,7 @@ class Q_DECL_EXPORT BackendInterface : public QObject
Q_DISABLE_COPY(BackendInterface)
public:
explicit BackendInterface(QObject* parent = 0);
explicit BackendInterface(QObject* parent = nullptr);
virtual ~BackendInterface();
/**
......
......@@ -487,22 +487,22 @@ void Core::emitNotification(const QString &evid, const QString &message, const Q
{
if (!iconname.isEmpty()) {
KNotification::event(evid, message, QIcon::fromTheme(iconname).pixmap(48,48),
0, KNotification::CloseOnTimeout, "powerdevil");
nullptr, KNotification::CloseOnTimeout, "powerdevil");
} else {
KNotification::event(evid, message, QPixmap(),
0, KNotification::CloseOnTimeout, "powerdevil");
nullptr, KNotification::CloseOnTimeout, "powerdevil");
}
}
void Core::emitNotification(const QString &eventId, const QString &title, const QString &message, const QString &iconName)
{
KNotification::event(eventId, title, message, iconName, 0, KNotification::CloseOnTimeout, "powerdevil");
KNotification::event(eventId, title, message, iconName, nullptr, KNotification::CloseOnTimeout, "powerdevil");
}
void Core::emitRichNotification(const QString &evid, const QString &title, const QString &message)
{
KNotification::event(evid, title, message, QPixmap(),
0, KNotification::CloseOnTimeout, "powerdevil");
nullptr, KNotification::CloseOnTimeout, "powerdevil");
}
bool Core::emitBatteryChargePercentNotification(int currentPercent, int previousPercent, const QString &udi)
......
......@@ -74,7 +74,7 @@ static const QString SCREEN_LOCKER_SERVICE_NAME = QStringLiteral("org.freedeskto
class PolicyAgentHelper
{
public:
PolicyAgentHelper() : q(0) { }
PolicyAgentHelper() : q(nullptr) { }
~PolicyAgentHelper() {
delete q;
}
......
......@@ -105,7 +105,7 @@ private Q_SLOTS:
void onActiveSessionChanged(const QString &activeSession);
private:
explicit PolicyAgent(QObject* parent = 0);
explicit PolicyAgent(QObject* parent = nullptr);
void init();
void startSessionInterruption();
......
......@@ -52,7 +52,7 @@ K_PLUGIN_FACTORY(PowerDevilActivitiesKCMFactory,
K_EXPORT_PLUGIN(PowerDevilActivitiesKCMFactory("powerdevilactivitiesconfig","powerdevil"))
ActivityPage::ActivityPage(QWidget *parent, const QVariantList &args)
: KCModule(0, parent, args)
: KCModule(nullptr, parent, args)
, m_activityConsumer(new KActivities::Consumer(this))
{
setButtons(Apply | Help);
......
......@@ -38,7 +38,7 @@ class ActivityWidget : public QWidget
{
Q_OBJECT
public:
explicit ActivityWidget(const QString &activity, QWidget *parent = 0);
explicit ActivityWidget(const QString &activity, QWidget *parent = nullptr);
virtual ~ActivityWidget();
public Q_SLOTS:
......
......@@ -26,7 +26,7 @@ class Q_DECL_EXPORT ErrorOverlay : public QWidget
{
Q_OBJECT
public:
explicit ErrorOverlay(QWidget *baseWidget, const QString &details, QWidget *parent = 0);
explicit ErrorOverlay(QWidget *baseWidget, const QString &details, QWidget *parent = nullptr);
virtual ~ErrorOverlay();
protected:
......
......@@ -47,7 +47,7 @@ void ActionConfigWidget::addWidgets(QList<QPair<QString, QWidget*> > configMap)
int row = m_gridLayout->rowCount();
row++;
QCheckBox* currentSectionCheckbox = 0;
QCheckBox* currentSectionCheckbox = nullptr;
QList<QPair<QString, QWidget*> >::const_iterator it;
for (it = configMap.constBegin(); it != configMap.constEnd(); ++it) {
......
......@@ -44,7 +44,7 @@ ActionEditWidget::ActionEditWidget(const QString &configName, QWidget *parent)
{
m_profilesConfig = KSharedConfig::openConfig("powermanagementprofilesrc", KConfig::SimpleConfig | KConfig::CascadeConfig);
ActionConfigWidget *actionConfigWidget = new ActionConfigWidget(0);
ActionConfigWidget *actionConfigWidget = new ActionConfigWidget(nullptr);
QMap< int, QList<QPair<QString, QWidget*> > > widgets;
// Load all the services
......
Supports Markdown
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