winrt: Code cleanup

Replace 0 with nullptr where applicable
Initialize members in declaration

Change-Id: I3d8bae845be01e27db2c591f8037d3823f25f67d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Oliver Wolff
2018-10-31 13:09:29 +01:00
parent d52ac9a708
commit e0b0c30748
8 changed files with 14 additions and 16 deletions

View File

@@ -42,7 +42,7 @@ using namespace ProjectExplorer;
namespace WinRt { namespace WinRt {
namespace Internal { namespace Internal {
WinRtDevice::WinRtDevice() : m_deviceId(-1) WinRtDevice::WinRtDevice()
{ {
initFreePorts(); initFreePorts();
} }
@@ -74,7 +74,7 @@ QString WinRtDevice::displayType() const
IDeviceWidget *WinRtDevice::createWidget() IDeviceWidget *WinRtDevice::createWidget()
{ {
return 0; return nullptr;
} }
QList<Core::Id> WinRtDevice::actionIds() const QList<Core::Id> WinRtDevice::actionIds() const

View File

@@ -60,7 +60,7 @@ private:
void initFreePorts(); void initFreePorts();
private: private:
int m_deviceId; int m_deviceId = -1;
}; };
} // Internal } // Internal

View File

@@ -48,8 +48,6 @@ namespace WinRt {
namespace Internal { namespace Internal {
WinRtDeviceFactory::WinRtDeviceFactory() WinRtDeviceFactory::WinRtDeviceFactory()
: m_process(0)
, m_initialized(false)
{ {
if (allPrerequisitesLoaded()) { if (allPrerequisitesLoaded()) {
onPrerequisitesLoaded(); onPrerequisitesLoaded();

View File

@@ -55,8 +55,8 @@ private:
QString findRunnerFilePath() const; QString findRunnerFilePath() const;
void parseRunnerOutput(const QByteArray &output) const; void parseRunnerOutput(const QByteArray &output) const;
Utils::QtcProcess *m_process; Utils::QtcProcess *m_process = nullptr;
bool m_initialized; bool m_initialized = false;
}; };
} // Internal } // Internal

View File

@@ -54,8 +54,8 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::restore(const QString &type,
const QVariantMap &data) const QVariantMap &data)
{ {
if (!canRestore(type)) if (!canRestore(type))
return 0; return nullptr;
WinRtQtVersion *v = 0; WinRtQtVersion *v = nullptr;
if (type == QLatin1String(Constants::WINRT_WINPHONEQT)) if (type == QLatin1String(Constants::WINRT_WINPHONEQT))
v = new WinRtPhoneQtVersion; v = new WinRtPhoneQtVersion;
else else
@@ -74,7 +74,7 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &q
{ {
QFileInfo fi = qmakePath.toFileInfo(); QFileInfo fi = qmakePath.toFileInfo();
if (!fi.exists() || !fi.isExecutable() || !fi.isFile()) if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
return 0; return nullptr;
bool isWinRt = false; bool isWinRt = false;
bool isPhone = false; bool isPhone = false;
@@ -89,7 +89,7 @@ QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &q
} }
if (!isWinRt) if (!isWinRt)
return 0; return nullptr;
return isPhone ? new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource) return isPhone ? new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource)
: new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource); : new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource);

View File

@@ -33,7 +33,7 @@ namespace Internal {
class WinRtQtVersionFactory : public QtSupport::QtVersionFactory class WinRtQtVersionFactory : public QtSupport::QtVersionFactory
{ {
public: public:
explicit WinRtQtVersionFactory(QObject *parent = 0); explicit WinRtQtVersionFactory(QObject *parent = nullptr);
~WinRtQtVersionFactory(); ~WinRtQtVersionFactory();
bool canRestore(const QString &type); bool canRestore(const QString &type);

View File

@@ -101,7 +101,7 @@ void WinRtRunner::onProcessError()
QTC_ASSERT(m_runner, return); QTC_ASSERT(m_runner, return);
m_runner->disconnect(); m_runner->disconnect();
m_runner->deleteLater(); m_runner->deleteLater();
m_runner = 0; m_runner = nullptr;
m_state = StoppedState; m_state = StoppedState;
reportStopped(); reportStopped();
} }

View File

@@ -152,7 +152,7 @@ void WinRtRunnerHelper::onProcessFinished(int exitCode, QProcess::ExitStatus exi
QTC_ASSERT(m_process, return); QTC_ASSERT(m_process, return);
m_process->disconnect(); m_process->disconnect();
m_process->deleteLater(); m_process->deleteLater();
m_process = 0; m_process = nullptr;
emit finished(exitCode, exitStatus); emit finished(exitCode, exitStatus);
} }
@@ -163,7 +163,7 @@ void WinRtRunnerHelper::onProcessError(QProcess::ProcessError processError)
m_process->errorString()), Utils::ErrorMessageFormat); m_process->errorString()), Utils::ErrorMessageFormat);
m_process->disconnect(); m_process->disconnect();
m_process->deleteLater(); m_process->deleteLater();
m_process = 0; m_process = nullptr;
emit error(processError); emit error(processError);
} }
@@ -176,7 +176,7 @@ void WinRtRunnerHelper::startWinRtRunner(const RunConf &conf)
QtcProcess::addArg(&runnerArgs, QString::number(m_device->deviceId())); QtcProcess::addArg(&runnerArgs, QString::number(m_device->deviceId()));
} }
QtcProcess *process = 0; QtcProcess *process = nullptr;
bool connectProcess = false; bool connectProcess = false;
switch (conf) { switch (conf) {