Replace 0 with nullptr

Prevents a lot of warnings seen in QtCreator

Change-Id: I63bf95aca68a04fc9fd0eecbe29c63e9b9c47efd
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
This commit is contained in:
Katja Marttila 2018-11-01 10:38:13 +02:00
parent 818c8ab983
commit 9dacee18f9
51 changed files with 199 additions and 199 deletions

View File

@ -293,7 +293,7 @@ void ResourceCollection::setName(const QByteArray &name)
void ResourceCollection::appendResource(const QSharedPointer<Resource>& resource) void ResourceCollection::appendResource(const QSharedPointer<Resource>& resource)
{ {
Q_ASSERT(resource); Q_ASSERT(resource);
resource->setParent(0); resource->setParent(nullptr);
m_resources.append(resource); m_resources.append(resource);
} }

View File

@ -81,7 +81,7 @@ namespace QInstaller {
*/ */
BinaryFormatEngine::BinaryFormatEngine(const QHash<QByteArray, ResourceCollection> &collections, BinaryFormatEngine::BinaryFormatEngine(const QHash<QByteArray, ResourceCollection> &collections,
const QString &fileName) const QString &fileName)
: m_resource(0) : m_resource(nullptr)
, m_collections(collections) , m_collections(collections)
{ {
setFileName(fileName); setFileName(fileName);

View File

@ -48,7 +48,7 @@ namespace QInstaller {
QAbstractFileEngine *BinaryFormatEngineHandler::create(const QString &fileName) const QAbstractFileEngine *BinaryFormatEngineHandler::create(const QString &fileName) const
{ {
return fileName.startsWith(QLatin1String("installer://"), Qt::CaseInsensitive ) return fileName.startsWith(QLatin1String("installer://"), Qt::CaseInsensitive )
? new BinaryFormatEngine(m_resources, fileName) : 0; ? new BinaryFormatEngine(m_resources, fileName) : nullptr;
} }
/*! /*!

View File

@ -41,9 +41,9 @@ namespace QInstaller {
ComponentPrivate::ComponentPrivate(PackageManagerCore *core, Component *qq) ComponentPrivate::ComponentPrivate(PackageManagerCore *core, Component *qq)
: q(qq) : q(qq)
, m_core(core) , m_core(core)
, m_parentComponent(0) , m_parentComponent(nullptr)
, m_licenseOperation(0) , m_licenseOperation(nullptr)
, m_minimumProgressOperation(0) , m_minimumProgressOperation(nullptr)
, m_newlyInstalled (false) , m_newlyInstalled (false)
, m_operationsCreated(false) , m_operationsCreated(false)
, m_autoCreateOperations(true) , m_autoCreateOperations(true)
@ -98,11 +98,11 @@ int ComponentModelHelper::childCount() const
Component *ComponentModelHelper::childAt(int index) const Component *ComponentModelHelper::childAt(int index) const
{ {
if (index < 0 && index >= childCount()) if (index < 0 && index >= childCount())
return 0; return nullptr;
if (m_componentPrivate->m_core->virtualComponentsVisible()) if (m_componentPrivate->m_core->virtualComponentsVisible())
return m_componentPrivate->m_allChildComponents.value(index, 0); return m_componentPrivate->m_allChildComponents.value(index, nullptr);
return m_componentPrivate->m_childComponents.value(index, 0); return m_componentPrivate->m_childComponents.value(index, nullptr);
} }
/*! /*!

View File

@ -378,7 +378,7 @@ Component *ComponentModel::componentFromIndex(const QModelIndex &index) const
{ {
if (index.isValid()) if (index.isValid())
return static_cast<Component*>(index.internalPointer()); return static_cast<Component*>(index.internalPointer());
return 0; return nullptr;
} }

View File

@ -380,7 +380,7 @@ void ComponentSelectionPagePrivate::customButtonClicked(int which)
if (QWizard::WizardButton(which) == QWizard::CustomButton2) { if (QWizard::WizardButton(which) == QWizard::CustomButton2) {
QString defaultDownloadDirectory = QString defaultDownloadDirectory =
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, QStringList fileNames = QFileDialog::getOpenFileNames(nullptr,
ComponentSelectionPage::tr("Open File"),defaultDownloadDirectory, ComponentSelectionPage::tr("Open File"),defaultDownloadDirectory,
QLatin1String("QBSP or 7z Files (*.qbsp *.7z)")); QLatin1String("QBSP or 7z Files (*.qbsp *.7z)"));

View File

@ -104,7 +104,7 @@ void CopyFileTask::doTask(QFutureInterface<FileTaskResult> &fi)
} }
observer.addSample(read); observer.addSample(read);
observer.timerEvent(NULL); observer.timerEvent(nullptr);
observer.addBytesTransfered(read); observer.addBytesTransfered(read);
observer.addCheckSumData(buffer.data(), read); observer.addCheckSumData(buffer.data(), read);

View File

@ -251,7 +251,7 @@ bool CreateLocalRepositoryOperation::performOperation()
// start to read the binary layout // start to read the binary layout
ResourceCollectionManager manager; ResourceCollectionManager manager;
BinaryContent::readBinaryContent(&file, 0, &manager, 0, BinaryContent::MagicCookie); BinaryContent::readBinaryContent(&file, nullptr, &manager, 0, BinaryContent::MagicCookie);
emit progressChanged(0.65); emit progressChanged(0.65);

View File

@ -50,7 +50,7 @@ typedef ITEMIDLIST *PIDLIST_ABSOLUTE;
struct DeCoInitializer struct DeCoInitializer
{ {
DeCoInitializer() DeCoInitializer()
: neededCoInit(CoInitialize(NULL) == S_OK) : neededCoInit(CoInitialize(nullptr) == S_OK)
{ {
} }
~DeCoInitializer() ~DeCoInitializer()
@ -100,12 +100,12 @@ static bool createLink(const QString &fileName, const QString &linkName, QString
// CoInitialize cleanup object // CoInitialize cleanup object
DeCoInitializer _; DeCoInitializer _;
IUnknown *iunkn = NULL; IUnknown *iunkn = nullptr;
if (fileName.toLower().startsWith(QLatin1String("http:")) if (fileName.toLower().startsWith(QLatin1String("http:"))
|| fileName.toLower().startsWith(QLatin1String("ftp:"))) { || fileName.toLower().startsWith(QLatin1String("ftp:"))) {
IUniformResourceLocator *iurl = NULL; IUniformResourceLocator *iurl = nullptr;
if (FAILED(CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, if (FAILED(CoCreateInstance(CLSID_InternetShortcut, nullptr, CLSCTX_INPROC_SERVER,
IID_IUniformResourceLocator, (LPVOID*)&iurl))) { IID_IUniformResourceLocator, (LPVOID*)&iurl))) {
return false; return false;
} }

View File

@ -49,7 +49,7 @@ using namespace KDUpdater;
DownloadArchivesJob::DownloadArchivesJob(PackageManagerCore *core) DownloadArchivesJob::DownloadArchivesJob(PackageManagerCore *core)
: Job(core) : Job(core)
, m_core(core) , m_core(core)
, m_downloader(0) , m_downloader(nullptr)
, m_archivesDownloaded(0) , m_archivesDownloaded(0)
, m_archivesToDownloadCount(0) , m_archivesToDownloadCount(0)
, m_canceled(false) , m_canceled(false)
@ -93,7 +93,7 @@ void DownloadArchivesJob::doStart()
void DownloadArchivesJob::doCancel() void DownloadArchivesJob::doCancel()
{ {
m_canceled = true; m_canceled = true;
if (m_downloader != 0) if (m_downloader != nullptr)
m_downloader->cancelDownload(); m_downloader->cancelDownload();
} }
@ -130,7 +130,7 @@ void DownloadArchivesJob::fetchNextArchiveHash()
void DownloadArchivesJob::finishedHashDownload() void DownloadArchivesJob::finishedHashDownload()
{ {
Q_ASSERT(m_downloader != 0); Q_ASSERT(m_downloader != nullptr);
QFile sha1HashFile(m_downloader->downloadedFileName()); QFile sha1HashFile(m_downloader->downloadedFileName());
if (sha1HashFile.open(QFile::ReadOnly)) { if (sha1HashFile.open(QFile::ReadOnly)) {
@ -156,7 +156,7 @@ void DownloadArchivesJob::fetchNextArchive()
return; return;
} }
if (m_downloader != 0) if (m_downloader != nullptr)
m_downloader->deleteLater(); m_downloader->deleteLater();
m_downloader = setupDownloader(QString(), m_core->value(scUrlQueryString)); m_downloader = setupDownloader(QString(), m_core->value(scUrlQueryString));
@ -202,7 +202,7 @@ void DownloadArchivesJob::timerEvent(QTimerEvent *event)
*/ */
void DownloadArchivesJob::registerFile() void DownloadArchivesJob::registerFile()
{ {
Q_ASSERT(m_downloader != 0); Q_ASSERT(m_downloader != nullptr);
if (m_canceled) if (m_canceled)
return; return;
@ -259,7 +259,7 @@ void DownloadArchivesJob::finishWithError(const QString &error)
{ {
const FileDownloader *const dl = qobject_cast<const FileDownloader*> (sender()); const FileDownloader *const dl = qobject_cast<const FileDownloader*> (sender());
const QString msg = tr("Cannot fetch archives: %1\nError while loading %2"); const QString msg = tr("Cannot fetch archives: %1\nError while loading %2");
if (dl != 0) if (dl != nullptr)
emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, dl->url().toString())); emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, dl->url().toString()));
else else
emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, m_downloader->url().toString())); emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, m_downloader->url().toString()));
@ -267,7 +267,7 @@ void DownloadArchivesJob::finishWithError(const QString &error)
KDUpdater::FileDownloader *DownloadArchivesJob::setupDownloader(const QString &suffix, const QString &queryString) KDUpdater::FileDownloader *DownloadArchivesJob::setupDownloader(const QString &suffix, const QString &queryString)
{ {
KDUpdater::FileDownloader *downloader = 0; KDUpdater::FileDownloader *downloader = nullptr;
const QFileInfo fi = QFileInfo(m_archivesToDownload.first().first); const QFileInfo fi = QFileInfo(m_archivesToDownload.first().first);
const Component *const component = m_core->componentByName(PackageManagerCore::checkableName(QFileInfo(fi.path()).fileName())); const Component *const component = m_core->componentByName(PackageManagerCore::checkableName(QFileInfo(fi.path()).fileName()));
if (component) { if (component) {

View File

@ -43,7 +43,7 @@ class ElevatedExecuteOperation::Private
public: public:
explicit Private(ElevatedExecuteOperation *qq) explicit Private(ElevatedExecuteOperation *qq)
: q(qq) : q(qq)
, process(0) , process(nullptr)
, showStandardError(false) , showStandardError(false)
{ {
} }
@ -221,7 +221,7 @@ bool ElevatedExecuteOperation::Private::run(const QStringList &arguments)
Q_ASSERT(process); Q_ASSERT(process);
Q_ASSERT(process->state() == QProcessWrapper::NotRunning); Q_ASSERT(process->state() == QProcessWrapper::NotRunning);
delete process; delete process;
process = 0; process = nullptr;
return returnValue; return returnValue;
} }

View File

@ -83,8 +83,8 @@ bool handleRegExpandSz(const QString &regPath, const QString &name,
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
DWORD dataType; DWORD dataType;
DWORD dataSize; DWORD dataSize;
res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(name.utf16()), 0, res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(name.utf16()), nullptr,
&dataType, 0, &dataSize); &dataType, nullptr, &dataSize);
setAsExpandSZ = (res == ERROR_SUCCESS) && (dataType == REG_EXPAND_SZ); setAsExpandSZ = (res == ERROR_SUCCESS) && (dataType == REG_EXPAND_SZ);
if (setAsExpandSZ) { if (setAsExpandSZ) {
RegCloseKey(handle); RegCloseKey(handle);

View File

@ -239,7 +239,7 @@ void QInstaller::removeDirectory(const QString &path, bool ignoreErrors)
class RemoveDirectoryThread : public QThread class RemoveDirectoryThread : public QThread
{ {
public: public:
explicit RemoveDirectoryThread(const QString &path, bool ignoreErrors = false, QObject *parent = 0) explicit RemoveDirectoryThread(const QString &path, bool ignoreErrors = false, QObject *parent = nullptr)
: QThread(parent) : QThread(parent)
, p(path) , p(path)
, ignore(ignoreErrors) , ignore(ignoreErrors)
@ -411,7 +411,7 @@ QString QInstaller::getShortPathName(const QString &name)
// Determine length, then convert. // Determine length, then convert.
const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGW const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGW
const DWORD length = GetShortPathName(nameC, NULL, 0); const DWORD length = GetShortPathName(nameC, nullptr, 0);
if (length == 0) if (length == 0)
return name; return name;
QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]); QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]);
@ -427,7 +427,7 @@ QString QInstaller::getLongPathName(const QString &name)
// Determine length, then convert. // Determine length, then convert.
const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGW const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGW
const DWORD length = GetLongPathName(nameC, NULL, 0); const DWORD length = GetLongPathName(nameC, nullptr, 0);
if (length == 0) if (length == 0)
return name; return name;
QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]); QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]);

View File

@ -96,7 +96,7 @@ bool GlobalSettingsOperation::testOperation()
QSettingsWrapper *GlobalSettingsOperation::setup(QString *key, QString *value, const QStringList &arguments) QSettingsWrapper *GlobalSettingsOperation::setup(QString *key, QString *value, const QStringList &arguments)
{ {
if (!checkArgumentCount(3, 5)) if (!checkArgumentCount(3, 5))
return 0; return nullptr;
if (arguments.count() == 5) { if (arguments.count() == 5) {
QSettingsWrapper::Scope scope = QSettingsWrapper::UserScope; QSettingsWrapper::Scope scope = QSettingsWrapper::UserScope;
@ -120,5 +120,5 @@ QSettingsWrapper *GlobalSettingsOperation::setup(QString *key, QString *value, c
return new QSettingsWrapper(filename, QSettingsWrapper::NativeFormat); return new QSettingsWrapper(filename, QSettingsWrapper::NativeFormat);
} }
return 0; return nullptr;
} }

View File

@ -130,7 +130,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
std::cout << qPrintable(ba) << std::endl; std::cout << qPrintable(ba) << std::endl;
if (type == QtFatalMsg) { if (type == QtFatalMsg) {
QtMessageHandler oldMsgHandler = qInstallMessageHandler(0); QtMessageHandler oldMsgHandler = qInstallMessageHandler(nullptr);
qt_message_output(type, context, msg); qt_message_output(type, context, msg);
qInstallMessageHandler(oldMsgHandler); qInstallMessageHandler(oldMsgHandler);
} }

View File

@ -35,8 +35,8 @@
namespace QInstaller { namespace QInstaller {
KeepAliveObject::KeepAliveObject() KeepAliveObject::KeepAliveObject()
: m_timer(0) : m_timer(nullptr)
, m_socket(0) , m_socket(nullptr)
{ {
} }

View File

@ -64,7 +64,7 @@
#include <memory> #include <memory>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
HINSTANCE g_hInstance = 0; HINSTANCE g_hInstance = nullptr;
# define S_IFMT 00170000 # define S_IFMT 00170000
# define S_IFLNK 0120000 # define S_IFLNK 0120000
@ -353,16 +353,16 @@ static quint32 getUInt32Property(IInArchive *archive, int index, int propId, qui
static QFile::Permissions getPermissions(IInArchive *archive, int index, bool *hasPermissions) static QFile::Permissions getPermissions(IInArchive *archive, int index, bool *hasPermissions)
{ {
quint32 attributes = getUInt32Property(archive, index, kpidAttrib, 0); quint32 attributes = getUInt32Property(archive, index, kpidAttrib, 0);
QFile::Permissions permissions = 0; QFile::Permissions permissions = nullptr;
if (attributes & FILE_ATTRIBUTE_UNIX_EXTENSION) { if (attributes & FILE_ATTRIBUTE_UNIX_EXTENSION) {
if (hasPermissions != 0) if (hasPermissions != nullptr)
*hasPermissions = true; *hasPermissions = true;
// filter the Unix permissions // filter the Unix permissions
attributes = (attributes >> 16) & 0777; attributes = (attributes >> 16) & 0777;
permissions |= static_cast<QFile::Permissions>((attributes & 0700) << 2); // owner rights permissions |= static_cast<QFile::Permissions>((attributes & 0700) << 2); // owner rights
permissions |= static_cast<QFile::Permissions>((attributes & 0070) << 1); // group permissions |= static_cast<QFile::Permissions>((attributes & 0070) << 1); // group
permissions |= static_cast<QFile::Permissions>((attributes & 0007) << 0); // and world rights permissions |= static_cast<QFile::Permissions>((attributes & 0007) << 0); // and world rights
} else if (hasPermissions != 0) { } else if (hasPermissions != nullptr) {
*hasPermissions = false; *hasPermissions = false;
} }
return permissions; return permissions;
@ -536,7 +536,7 @@ QVector<File> listArchive(QFileDevice *archive)
f.archiveIndex.setY(item); f.archiveIndex.setY(item);
f.path = UString2QString(s).replace(QLatin1Char('\\'), QLatin1Char('/')); f.path = UString2QString(s).replace(QLatin1Char('\\'), QLatin1Char('/'));
Archive_IsItem_Folder(arch, item, f.isDirectory); Archive_IsItem_Folder(arch, item, f.isDirectory);
f.permissions = getPermissions(arch, item, 0); f.permissions = getPermissions(arch, item, nullptr);
getDateTimeProperty(arch, item, kpidMTime, &(f.utcTime)); getDateTimeProperty(arch, item, kpidMTime, &(f.utcTime));
f.uncompressedSize = getUInt64Property(arch, item, kpidSize, 0); f.uncompressedSize = getUInt64Property(arch, item, kpidSize, 0);
f.compressedSize = getUInt64Property(arch, item, kpidPackSize, 0); f.compressedSize = getUInt64Property(arch, item, kpidPackSize, 0);
@ -579,7 +579,7 @@ STDMETHODIMP ExtractCallback::SetCompleted(const UInt64 *c)
// CDecoder::CodeSpec extracted content to an output stream. // CDecoder::CodeSpec extracted content to an output stream.
STDMETHODIMP ExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 /*askExtractMode*/) STDMETHODIMP ExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 /*askExtractMode*/)
{ {
*outStream = 0; *outStream = nullptr;
if (targetDir.isEmpty()) if (targetDir.isEmpty())
return E_FAIL; return E_FAIL;
@ -790,14 +790,14 @@ HRESULT UpdateCallback::OpenFileError(const wchar_t*, DWORD)
HRESULT UpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password) HRESULT UpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{ {
*password = 0; *password = nullptr;
*passwordIsDefined = false; *passwordIsDefined = false;
return S_OK; return S_OK;
} }
HRESULT UpdateCallback::CryptoGetTextPassword(BSTR *password) HRESULT UpdateCallback::CryptoGetTextPassword(BSTR *password)
{ {
*password = 0; *password = nullptr;
return E_NOTIMPL; return E_NOTIMPL;
} }

View File

@ -84,8 +84,8 @@ public:
: m_dirHandle(INVALID_HANDLE_VALUE) : m_dirHandle(INVALID_HANDLE_VALUE)
{ {
QString normalizedPath = QString(path).replace(QLatin1Char('/'), QLatin1Char('\\')); QString normalizedPath = QString(path).replace(QLatin1Char('/'), QLatin1Char('\\'));
m_dirHandle = CreateFile((wchar_t*)normalizedPath.utf16(), GENERIC_READ | GENERIC_WRITE, 0, 0, m_dirHandle = CreateFile((wchar_t*)normalizedPath.utf16(), GENERIC_READ | GENERIC_WRITE, 0, nullptr,
OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0); OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nullptr);
if (m_dirHandle == INVALID_HANDLE_VALUE) { if (m_dirHandle == INVALID_HANDLE_VALUE) {
qWarning() << "Cannot open" << path << ":" << QInstaller::windowsErrorString(GetLastError()); qWarning() << "Cannot open" << path << ":" << QInstaller::windowsErrorString(GetLastError());
@ -112,7 +112,7 @@ QString readWindowsSymLink(const QString &path)
if (dirHandle.handle() != INVALID_HANDLE_VALUE) { if (dirHandle.handle() != INVALID_HANDLE_VALUE) {
REPARSE_DATA_BUFFER* reparseStructData = (REPARSE_DATA_BUFFER*)calloc(1, MAXIMUM_REPARSE_DATA_BUFFER_SIZE); REPARSE_DATA_BUFFER* reparseStructData = (REPARSE_DATA_BUFFER*)calloc(1, MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
DWORD bytesReturned = 0; DWORD bytesReturned = 0;
if (::DeviceIoControl(dirHandle.handle(), FSCTL_GET_REPARSE_POINT, 0, 0, reparseStructData, if (::DeviceIoControl(dirHandle.handle(), FSCTL_GET_REPARSE_POINT, nullptr, 0, reparseStructData,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned, 0)) { MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned, 0)) {
if (reparseStructData->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { if (reparseStructData->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
int length = reparseStructData->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar_t); int length = reparseStructData->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar_t);
@ -170,8 +170,8 @@ Link createJunction(const QString &linkPath, const QString &targetPath)
DWORD bytesReturned; DWORD bytesReturned;
if (!::DeviceIoControl(dirHandle.handle(), FSCTL_SET_REPARSE_POINT, reparseStructData, if (!::DeviceIoControl(dirHandle.handle(), FSCTL_SET_REPARSE_POINT, reparseStructData,
reparseStructData->ReparseDataLength + REPARSE_DATA_BUFFER_HEADER_SIZE, 0, 0, reparseStructData->ReparseDataLength + REPARSE_DATA_BUFFER_HEADER_SIZE, nullptr, 0,
&bytesReturned, 0)) { &bytesReturned, nullptr)) {
qWarning() << "Cannot set the reparse point for" << linkPath << "to" << targetPath qWarning() << "Cannot set the reparse point for" << linkPath << "to" << targetPath
<< ":" << QInstaller::windowsErrorString(GetLastError()); << ":" << QInstaller::windowsErrorString(GetLastError());
} }
@ -191,8 +191,8 @@ bool removeJunction(const QString &path)
DWORD bytesReturned; DWORD bytesReturned;
if (!::DeviceIoControl(dirHandle.handle(), FSCTL_DELETE_REPARSE_POINT, reparseStructData, if (!::DeviceIoControl(dirHandle.handle(), FSCTL_DELETE_REPARSE_POINT, reparseStructData,
REPARSE_GUID_DATA_BUFFER_HEADER_SIZE, 0, 0, REPARSE_GUID_DATA_BUFFER_HEADER_SIZE, nullptr, 0,
&bytesReturned, 0)) { &bytesReturned, nullptr)) {
qWarning() << "Cannot remove the reparse point" << path << ":" << QInstaller::windowsErrorString(GetLastError()); qWarning() << "Cannot remove the reparse point" << path << ":" << QInstaller::windowsErrorString(GetLastError());
return false; return false;

View File

@ -107,7 +107,7 @@ using namespace QInstaller;
Reports non-critical errors. Reports non-critical errors.
*/ */
MessageBoxHandler *MessageBoxHandler::m_instance = 0; MessageBoxHandler *MessageBoxHandler::m_instance = nullptr;
MessageBoxHandler::MessageBoxHandler(QObject *parent) MessageBoxHandler::MessageBoxHandler(QObject *parent)
: QObject(parent) : QObject(parent)
@ -120,7 +120,7 @@ MessageBoxHandler::MessageBoxHandler(QObject *parent)
*/ */
MessageBoxHandler *MessageBoxHandler::instance() MessageBoxHandler *MessageBoxHandler::instance()
{ {
if (m_instance == 0) if (m_instance == nullptr)
m_instance = new MessageBoxHandler(qApp); m_instance = new MessageBoxHandler(qApp);
return m_instance; return m_instance;
} }
@ -131,8 +131,8 @@ MessageBoxHandler *MessageBoxHandler::instance()
*/ */
QWidget *MessageBoxHandler::currentBestSuitParent() QWidget *MessageBoxHandler::currentBestSuitParent()
{ {
if (qobject_cast<QApplication*> (qApp) == 0) if (qobject_cast<QApplication*> (qApp) == nullptr)
return 0; return nullptr;
if (qApp->activeModalWidget()) if (qApp->activeModalWidget())
return qApp->activeModalWidget(); return qApp->activeModalWidget();
@ -363,7 +363,7 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBo
{ {
QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent); QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent);
QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox *>(); QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox *>();
Q_ASSERT(buttonBox != 0); Q_ASSERT(buttonBox != nullptr);
uint mask = QMessageBox::FirstButton; uint mask = QMessageBox::FirstButton;
while (mask <= QMessageBox::LastButton) { while (mask <= QMessageBox::LastButton) {
@ -404,7 +404,7 @@ QMessageBox::StandardButton MessageBoxHandler::showMessageBox(MessageType messag
qDebug().nospace() << "Created " << messageTypeHash.value(messageType).toUtf8().constData() qDebug().nospace() << "Created " << messageTypeHash.value(messageType).toUtf8().constData()
<< " message box " << identifier << ": " << title << ", " << text; << " message box " << identifier << ": " << title << ", " << text;
if (qobject_cast<QApplication*> (qApp) == 0) if (qobject_cast<QApplication*> (qApp) == nullptr)
return defaultButton; return defaultButton;
if (m_automaticAnswers.contains(identifier)) if (m_automaticAnswers.contains(identifier))

View File

@ -53,7 +53,7 @@ static QUrl resolveUrl(const FileTaskResult &result, const QString &url)
MetadataJob::MetadataJob(QObject *parent) MetadataJob::MetadataJob(QObject *parent)
: Job(parent) : Job(parent)
, m_core(0) , m_core(nullptr)
, m_addCompressedPackages(false) , m_addCompressedPackages(false)
, m_downloadableChunkSize(1000) , m_downloadableChunkSize(1000)
, m_taskNumber(0) , m_taskNumber(0)

View File

@ -392,7 +392,7 @@ using namespace QInstaller;
Q_GLOBAL_STATIC(QMutex, globalModelMutex); Q_GLOBAL_STATIC(QMutex, globalModelMutex);
static QFont *sVirtualComponentsFont = 0; static QFont *sVirtualComponentsFont = nullptr;
Q_GLOBAL_STATIC(QMutex, globalVirtualComponentsFontMutex); Q_GLOBAL_STATIC(QMutex, globalVirtualComponentsFontMutex);
static bool sNoForceInstallation = false; static bool sNoForceInstallation = false;
@ -697,7 +697,7 @@ void PackageManagerCore::rollBackInstallation()
// reregister all the undo operations with the new size to the ProgressCoordinator // reregister all the undo operations with the new size to the ProgressCoordinator
foreach (Operation *const operation, d->m_performedOperationsCurrentSession) { foreach (Operation *const operation, d->m_performedOperationsCurrentSession) {
QObject *const operationObject = dynamic_cast<QObject*> (operation); QObject *const operationObject = dynamic_cast<QObject*> (operation);
if (operationObject != 0) { if (operationObject != nullptr) {
const QMetaObject* const mo = operationObject->metaObject(); const QMetaObject* const mo = operationObject->metaObject();
if (mo->indexOfSignal(QMetaObject::normalizedSignature("progressChanged(double)")) > -1) { if (mo->indexOfSignal(QMetaObject::normalizedSignature("progressChanged(double)")) > -1) {
ProgressCoordinator::instance()->registerPartProgress(operationObject, ProgressCoordinator::instance()->registerPartProgress(operationObject,
@ -939,7 +939,7 @@ PackageManagerCore::~PackageManagerCore()
QMutexLocker _(globalVirtualComponentsFontMutex()); QMutexLocker _(globalVirtualComponentsFontMutex());
delete sVirtualComponentsFont; delete sVirtualComponentsFont;
sVirtualComponentsFont = 0; sVirtualComponentsFont = nullptr;
} }
/* static */ /* static */
@ -1549,7 +1549,7 @@ Component *PackageManagerCore::componentByName(const QString &name) const
Component *PackageManagerCore::componentByName(const QString &name, const QList<Component *> &components) Component *PackageManagerCore::componentByName(const QString &name, const QList<Component *> &components)
{ {
if (name.isEmpty()) if (name.isEmpty())
return 0; return nullptr;
QString fixedVersion; QString fixedVersion;
QString fixedName; QString fixedName;
@ -1561,7 +1561,7 @@ Component *PackageManagerCore::componentByName(const QString &name, const QList<
return component; return component;
} }
return 0; return nullptr;
} }
/*! /*!

View File

@ -81,7 +81,7 @@ namespace QInstaller {
class OperationTracer class OperationTracer
{ {
public: public:
OperationTracer(Operation *operation) : m_operation(0) OperationTracer(Operation *operation) : m_operation(nullptr)
{ {
// don't create output for that hacky pseudo operation // don't create output for that hacky pseudo operation
if (operation->name() != QLatin1String("MinimumProgress")) if (operation->name() != QLatin1String("MinimumProgress"))
@ -197,29 +197,29 @@ static void deferredRename(const QString &oldName, const QString &newName, bool
// -- PackageManagerCorePrivate // -- PackageManagerCorePrivate
PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core) PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core)
: m_updateFinder(0) : m_updateFinder(nullptr)
, m_compressedFinder(0) , m_compressedFinder(nullptr)
, m_localPackageHub(std::make_shared<LocalPackageHub>()) , m_localPackageHub(std::make_shared<LocalPackageHub>())
, m_core(core) , m_core(core)
, m_updates(false) , m_updates(false)
, m_repoFetched(false) , m_repoFetched(false)
, m_updateSourcesAdded(false) , m_updateSourcesAdded(false)
, m_componentsToInstallCalculated(false) , m_componentsToInstallCalculated(false)
, m_componentScriptEngine(0) , m_componentScriptEngine(nullptr)
, m_controlScriptEngine(0) , m_controlScriptEngine(nullptr)
, m_installerCalculator(0) , m_installerCalculator(nullptr)
, m_uninstallerCalculator(0) , m_uninstallerCalculator(nullptr)
, m_proxyFactory(0) , m_proxyFactory(nullptr)
, m_defaultModel(0) , m_defaultModel(nullptr)
, m_updaterModel(0) , m_updaterModel(nullptr)
, m_guiObject(0) , m_guiObject(nullptr)
{ {
} }
PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, qint64 magicInstallerMaker, PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, qint64 magicInstallerMaker,
const QList<OperationBlob> &performedOperations) const QList<OperationBlob> &performedOperations)
: m_updateFinder(0) : m_updateFinder(nullptr)
, m_compressedFinder(0) , m_compressedFinder(nullptr)
, m_localPackageHub(std::make_shared<LocalPackageHub>()) , m_localPackageHub(std::make_shared<LocalPackageHub>())
, m_status(PackageManagerCore::Unfinished) , m_status(PackageManagerCore::Unfinished)
, m_needsHardRestart(false) , m_needsHardRestart(false)
@ -234,14 +234,14 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q
, m_updateSourcesAdded(false) , m_updateSourcesAdded(false)
, m_magicBinaryMarker(magicInstallerMaker) , m_magicBinaryMarker(magicInstallerMaker)
, m_componentsToInstallCalculated(false) , m_componentsToInstallCalculated(false)
, m_componentScriptEngine(0) , m_componentScriptEngine(nullptr)
, m_controlScriptEngine(0) , m_controlScriptEngine(nullptr)
, m_installerCalculator(0) , m_installerCalculator(nullptr)
, m_uninstallerCalculator(0) , m_uninstallerCalculator(nullptr)
, m_proxyFactory(0) , m_proxyFactory(nullptr)
, m_defaultModel(0) , m_defaultModel(nullptr)
, m_updaterModel(0) , m_updaterModel(nullptr)
, m_guiObject(0) , m_guiObject(nullptr)
{ {
foreach (const OperationBlob &operation, performedOperations) { foreach (const OperationBlob &operation, performedOperations) {
QScopedPointer<QInstaller::Operation> op(KDUpdater::UpdateOperationFactory::instance() QScopedPointer<QInstaller::Operation> op(KDUpdater::UpdateOperationFactory::instance()
@ -363,7 +363,7 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
for (it = components.constBegin(); it != components.constEnd(); ++it) { for (it = components.constBegin(); it != components.constEnd(); ++it) {
QString id = it.key(); QString id = it.key();
QInstaller::Component *component = it.value(); QInstaller::Component *component = it.value();
while (!id.isEmpty() && component->parentComponent() == 0) { while (!id.isEmpty() && component->parentComponent() == nullptr) {
id = id.section(QLatin1Char('.'), 0, -2); id = id.section(QLatin1Char('.'), 0, -2);
if (components.contains(id)) if (components.contains(id))
components[id]->appendComponent(component); components[id]->appendComponent(component);
@ -372,7 +372,7 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
// append all components w/o parent to the direct list // append all components w/o parent to the direct list
foreach (QInstaller::Component *component, components) { foreach (QInstaller::Component *component, components) {
if (component->parentComponent() == 0) if (component->parentComponent() == nullptr)
m_core->appendRootComponent(component); m_core->appendRootComponent(component);
} }
@ -443,7 +443,7 @@ void PackageManagerCorePrivate::cleanUpComponentEnvironment()
// there could be still some references to already deleted components, // there could be still some references to already deleted components,
// so we need to remove the current component script engine // so we need to remove the current component script engine
delete m_componentScriptEngine; delete m_componentScriptEngine;
m_componentScriptEngine = 0; m_componentScriptEngine = nullptr;
} }
ScriptEngine *PackageManagerCorePrivate::componentScriptEngine() const ScriptEngine *PackageManagerCorePrivate::componentScriptEngine() const
@ -517,7 +517,7 @@ QHash<QString, QPair<Component*, Component*> > &PackageManagerCorePrivate::compo
void PackageManagerCorePrivate::clearInstallerCalculator() void PackageManagerCorePrivate::clearInstallerCalculator()
{ {
delete m_installerCalculator; delete m_installerCalculator;
m_installerCalculator = 0; m_installerCalculator = nullptr;
} }
InstallerCalculator *PackageManagerCorePrivate::installerCalculator() const InstallerCalculator *PackageManagerCorePrivate::installerCalculator() const
@ -533,7 +533,7 @@ InstallerCalculator *PackageManagerCorePrivate::installerCalculator() const
void PackageManagerCorePrivate::clearUninstallerCalculator() void PackageManagerCorePrivate::clearUninstallerCalculator()
{ {
delete m_uninstallerCalculator; delete m_uninstallerCalculator;
m_uninstallerCalculator = 0; m_uninstallerCalculator = nullptr;
} }
UninstallerCalculator *PackageManagerCorePrivate::uninstallerCalculator() const UninstallerCalculator *PackageManagerCorePrivate::uninstallerCalculator() const
@ -685,7 +685,7 @@ Operation *PackageManagerCorePrivate::createOwnedOperation(const QString &type)
Operation *PackageManagerCorePrivate::takeOwnedOperation(Operation *operation) Operation *PackageManagerCorePrivate::takeOwnedOperation(Operation *operation)
{ {
if (!m_ownedOperations.contains(operation)) if (!m_ownedOperations.contains(operation))
return 0; return nullptr;
m_ownedOperations.removeAll(operation); m_ownedOperations.removeAll(operation);
return operation; return operation;
@ -939,7 +939,7 @@ void PackageManagerCorePrivate::connectOperationToInstaller(Operation *const ope
{ {
Q_ASSERT(operationPartSize); Q_ASSERT(operationPartSize);
QObject *const operationObject = dynamic_cast< QObject*> (operation); QObject *const operationObject = dynamic_cast< QObject*> (operation);
if (operationObject != 0) { if (operationObject != nullptr) {
const QMetaObject *const mo = operationObject->metaObject(); const QMetaObject *const mo = operationObject->metaObject();
if (mo->indexOfSignal(QMetaObject::normalizedSignature("outputTextChanged(QString)")) > -1) { if (mo->indexOfSignal(QMetaObject::normalizedSignature("outputTextChanged(QString)")) > -1) {
connect(operationObject, SIGNAL(outputTextChanged(QString)), ProgressCoordinator::instance(), connect(operationObject, SIGNAL(outputTextChanged(QString)), ProgressCoordinator::instance(),
@ -1653,7 +1653,7 @@ bool PackageManagerCorePrivate::runPackageUpdater()
// build a list of undo operations based on the checked state of the component // build a list of undo operations based on the checked state of the component
foreach (Operation *operation, performedOperationsOld) { foreach (Operation *operation, performedOperationsOld) {
const QString &name = operation->value(QLatin1String("component")).toString(); const QString &name = operation->value(QLatin1String("component")).toString();
Component *component = componentsByName.value(name, 0); Component *component = componentsByName.value(name, nullptr);
if (!component) if (!component)
component = m_core->componentByName(PackageManagerCore::checkableName(name)); component = m_core->componentByName(PackageManagerCore::checkableName(name));
if (component) if (component)
@ -2374,7 +2374,7 @@ void PackageManagerCorePrivate::storeCheckState()
void PackageManagerCorePrivate::connectOperationCallMethodRequest(Operation *const operation) void PackageManagerCorePrivate::connectOperationCallMethodRequest(Operation *const operation)
{ {
QObject *const operationObject = dynamic_cast<QObject *> (operation); QObject *const operationObject = dynamic_cast<QObject *> (operation);
if (operationObject != 0) { if (operationObject != nullptr) {
const QMetaObject *const mo = operationObject->metaObject(); const QMetaObject *const mo = operationObject->metaObject();
if (mo->indexOfSignal(QMetaObject::normalizedSignature("requestBlockingExecution(QString)")) > -1) { if (mo->indexOfSignal(QMetaObject::normalizedSignature("requestBlockingExecution(QString)")) > -1) {
connect(operationObject, SIGNAL(requestBlockingExecution(QString)), connect(operationObject, SIGNAL(requestBlockingExecution(QString)),
@ -2417,7 +2417,7 @@ OperationList PackageManagerCorePrivate::sortOperationsBasedOnComponentDependenc
void PackageManagerCorePrivate::handleMethodInvocationRequest(const QString &invokableMethodName) void PackageManagerCorePrivate::handleMethodInvocationRequest(const QString &invokableMethodName)
{ {
QObject *obj = QObject::sender(); QObject *obj = QObject::sender();
if (obj != 0) if (obj != nullptr)
QMetaObject::invokeMethod(obj, qPrintable(invokableMethodName)); QMetaObject::invokeMethod(obj, qPrintable(invokableMethodName));
} }

View File

@ -108,7 +108,7 @@ void PackageManagerCoreData::setDynamicPredefinedVariables()
QString dir = QLatin1String("/opt"); QString dir = QLatin1String("/opt");
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
TCHAR buffer[MAX_PATH + 1] = { 0 }; TCHAR buffer[MAX_PATH + 1] = { 0 };
SHGetFolderPath(0, CSIDL_PROGRAM_FILES, 0, 0, buffer); SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILES, nullptr, 0, buffer);
dir = QString::fromWCharArray(buffer); dir = QString::fromWCharArray(buffer);
#elif defined (Q_OS_OSX) #elif defined (Q_OS_OSX)
dir = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(0); dir = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(0);

View File

@ -95,7 +95,7 @@ class DynamicInstallerPage : public PackageManagerPage
Q_PROPERTY(bool complete READ isComplete WRITE setComplete) Q_PROPERTY(bool complete READ isComplete WRITE setComplete)
public: public:
explicit DynamicInstallerPage(QWidget *widget, PackageManagerCore *core = 0) explicit DynamicInstallerPage(QWidget *widget, PackageManagerCore *core = nullptr)
: PackageManagerPage(core) : PackageManagerPage(core)
, m_widget(widget) , m_widget(widget)
{ {
@ -398,7 +398,7 @@ void PackageManagerGui::setMaxSize()
*/ */
PackageManagerGui::~PackageManagerGui() PackageManagerGui::~PackageManagerGui()
{ {
m_core->setGuiObject(0); m_core->setGuiObject(nullptr);
delete d; delete d;
} }
@ -665,7 +665,7 @@ void PackageManagerGui::wizardPageInsertionRequested(QWidget *widget,
wizardPageRemovalRequested(widget); wizardPageRemovalRequested(widget);
int pageId = static_cast<int>(page) - 1; int pageId = static_cast<int>(page) - 1;
while (QWizard::page(pageId) != 0) while (QWizard::page(pageId) != nullptr)
--pageId; --pageId;
// add it // add it
@ -679,7 +679,7 @@ void PackageManagerGui::wizardPageRemovalRequested(QWidget *widget)
{ {
foreach (int pageId, pageIds()) { foreach (int pageId, pageIds()) {
DynamicInstallerPage *const dynamicPage = qobject_cast<DynamicInstallerPage*>(page(pageId)); DynamicInstallerPage *const dynamicPage = qobject_cast<DynamicInstallerPage*>(page(pageId));
if (dynamicPage == 0) if (dynamicPage == nullptr)
continue; continue;
if (dynamicPage->widget() != widget) if (dynamicPage->widget() != widget)
continue; continue;
@ -710,7 +710,7 @@ void PackageManagerGui::wizardWidgetInsertionRequested(QWidget *widget,
void PackageManagerGui::wizardWidgetRemovalRequested(QWidget *widget) void PackageManagerGui::wizardWidgetRemovalRequested(QWidget *widget)
{ {
Q_ASSERT(widget); Q_ASSERT(widget);
widget->setParent(0); widget->setParent(nullptr);
packageManagerCore()->controlScriptEngine()->removeFromGlobalObject(widget); packageManagerCore()->controlScriptEngine()->removeFromGlobalObject(widget);
packageManagerCore()->componentScriptEngine()->removeFromGlobalObject(widget); packageManagerCore()->componentScriptEngine()->removeFromGlobalObject(widget);
} }
@ -721,9 +721,9 @@ void PackageManagerGui::wizardWidgetRemovalRequested(QWidget *widget)
*/ */
void PackageManagerGui::wizardPageVisibilityChangeRequested(bool visible, int p) void PackageManagerGui::wizardPageVisibilityChangeRequested(bool visible, int p)
{ {
if (visible && page(p) == 0) { if (visible && page(p) == nullptr) {
setPage(p, d->m_defaultPages[p]); setPage(p, d->m_defaultPages[p]);
} else if (!visible && page(p) != 0) { } else if (!visible && page(p) != nullptr) {
d->m_defaultPages[p] = page(p); d->m_defaultPages[p] = page(p);
removePage(p); removePage(p);
} }
@ -753,7 +753,7 @@ QWidget *PackageManagerGui::pageByObjectName(const QString &name) const
return p; return p;
} }
qWarning() << "No page found for object name" << name; qWarning() << "No page found for object name" << name;
return 0; return nullptr;
} }
/*! /*!
@ -781,7 +781,7 @@ QWidget *PackageManagerGui::pageWidgetByObjectName(const QString &name) const
return p; return p;
} }
qWarning() << "No page found for object name" << name; qWarning() << "No page found for object name" << name;
return 0; return nullptr;
} }
/*! /*!
@ -1057,7 +1057,7 @@ PackageManagerPage::PackageManagerPage(PackageManagerCore *core)
: m_complete(true) : m_complete(true)
, m_needsSettingsButton(false) , m_needsSettingsButton(false)
, m_core(core) , m_core(core)
, validatorComponent(0) , validatorComponent(nullptr)
{ {
if (!m_core->settings().titleColor().isEmpty()) { if (!m_core->settings().titleColor().isEmpty()) {
m_titleColor = m_core->settings().titleColor(); m_titleColor = m_core->settings().titleColor();
@ -1192,8 +1192,8 @@ bool PackageManagerPage::validatePage()
void PackageManagerPage::insertWidget(QWidget *widget, const QString &siblingName, int offset) void PackageManagerPage::insertWidget(QWidget *widget, const QString &siblingName, int offset)
{ {
QWidget *sibling = findChild<QWidget *>(siblingName); QWidget *sibling = findChild<QWidget *>(siblingName);
QWidget *parent = sibling ? sibling->parentWidget() : 0; QWidget *parent = sibling ? sibling->parentWidget() : nullptr;
QLayout *layout = parent ? parent->layout() : 0; QLayout *layout = parent ? parent->layout() : nullptr;
QBoxLayout *blayout = qobject_cast<QBoxLayout *>(layout); QBoxLayout *blayout = qobject_cast<QBoxLayout *>(layout);
if (blayout) { if (blayout) {
@ -1264,13 +1264,13 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core)
: PackageManagerPage(core) : PackageManagerPage(core)
, m_updatesFetched(false) , m_updatesFetched(false)
, m_allPackagesFetched(false) , m_allPackagesFetched(false)
, m_label(0) , m_label(nullptr)
, m_msgLabel(0) , m_msgLabel(nullptr)
, m_errorLabel(0) , m_errorLabel(nullptr)
, m_progressBar(0) , m_progressBar(nullptr)
, m_packageManager(0) , m_packageManager(nullptr)
, m_updateComponents(0) , m_updateComponents(nullptr)
, m_removeAllComponents(0) , m_removeAllComponents(nullptr)
{ {
setObjectName(QLatin1String("IntroductionPage")); setObjectName(QLatin1String("IntroductionPage"));
setColoredTitle(tr("Setup - %1").arg(productName())); setColoredTitle(tr("Setup - %1").arg(productName()));
@ -1347,7 +1347,7 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core)
connect(core, &PackageManagerCore::metaJobProgress, connect(core, &PackageManagerCore::metaJobProgress,
m_taskButton->progress(), &QWinTaskbarProgress::setValue); m_taskButton->progress(), &QWinTaskbarProgress::setValue);
} else { } else {
m_taskButton = 0; m_taskButton = nullptr;
} }
#endif #endif
} }
@ -2802,7 +2802,7 @@ void PerformInstallationPage::toggleDetailsWereChanged()
*/ */
FinishedPage::FinishedPage(PackageManagerCore *core) FinishedPage::FinishedPage(PackageManagerCore *core)
: PackageManagerPage(core) : PackageManagerPage(core)
, m_commitButton(0) , m_commitButton(nullptr)
{ {
setObjectName(QLatin1String("FinishedPage")); setObjectName(QLatin1String("FinishedPage"));
setColoredTitle(tr("Completing the %1 Wizard").arg(productName())); setColoredTitle(tr("Completing the %1 Wizard").arg(productName()));
@ -2835,7 +2835,7 @@ void FinishedPage::entering()
if (m_commitButton) { if (m_commitButton) {
disconnect(m_commitButton, &QAbstractButton::clicked, this, &FinishedPage::handleFinishClicked); disconnect(m_commitButton, &QAbstractButton::clicked, this, &FinishedPage::handleFinishClicked);
m_commitButton = 0; m_commitButton = nullptr;
} }
if (packageManagerCore()->isMaintainer()) { if (packageManagerCore()->isMaintainer()) {

View File

@ -76,18 +76,18 @@ using namespace QInstaller;
*/ */
PerformInstallationForm::PerformInstallationForm(QObject *parent) PerformInstallationForm::PerformInstallationForm(QObject *parent)
: QObject(parent) : QObject(parent)
, m_progressBar(0) , m_progressBar(nullptr)
, m_progressLabel(0) , m_progressLabel(nullptr)
, m_detailsButton(0) , m_detailsButton(nullptr)
, m_detailsBrowser(0) , m_detailsBrowser(nullptr)
, m_updateTimer(0) , m_updateTimer(nullptr)
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
m_taskButton = new QWinTaskbarButton(this); m_taskButton = new QWinTaskbarButton(this);
m_taskButton->progress()->setVisible(true); m_taskButton->progress()->setVisible(true);
} else { } else {
m_taskButton = 0; m_taskButton = nullptr;
} }
#endif #endif
} }

View File

@ -59,8 +59,8 @@ ProgressCoordinator::~ProgressCoordinator()
ProgressCoordinator *ProgressCoordinator::instance() ProgressCoordinator *ProgressCoordinator::instance()
{ {
static ProgressCoordinator *instance = 0; static ProgressCoordinator *instance =nullptr;
if (instance == 0) if (instance == nullptr)
instance = new ProgressCoordinator(qApp); instance = new ProgressCoordinator(qApp);
return instance; return instance;
} }

View File

@ -109,7 +109,7 @@ bool QProcessWrapper::startDetached(const QString &program, const QStringList &a
const QPair<bool, qint64> result = const QPair<bool, qint64> result =
w.callRemoteMethod<QPair<bool, qint64> >(QLatin1String(Protocol::QProcessStartDetached), w.callRemoteMethod<QPair<bool, qint64> >(QLatin1String(Protocol::QProcessStartDetached),
program, arguments, workingDirectory); program, arguments, workingDirectory);
if (pid != 0) if (pid != nullptr)
*pid = result.second; *pid = result.second;
w.processSignals(); w.processSignals();
return result.first; return result.first;

View File

@ -133,7 +133,7 @@ bool RegisterFileTypeOperation::performOperation()
setValue(QLatin1String("newType"), readHive(&settings, classesFileType)); setValue(QLatin1String("newType"), readHive(&settings, classesFileType));
// force the shell to invalidate its cache // force the shell to invalidate its cache
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
return true; return true;
#else #else
@ -192,7 +192,7 @@ bool RegisterFileTypeOperation::undoOperation()
settings.remove(classesApplications); settings.remove(classesApplications);
// force the shell to invalidate its cache // force the shell to invalidate its cache
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
return true; return true;
#else #else

View File

@ -31,7 +31,7 @@
namespace QInstaller { namespace QInstaller {
RemoteClient *RemoteClient::s_instance = 0; RemoteClient *RemoteClient::s_instance = nullptr;
RemoteClient::RemoteClient() RemoteClient::RemoteClient()
: d_ptr(new RemoteClientPrivate(this)) : d_ptr(new RemoteClientPrivate(this))
@ -88,7 +88,7 @@ void RemoteClient::shutdown()
void RemoteClient::destroy() void RemoteClient::destroy()
{ {
delete s_instance; delete s_instance;
s_instance = 0; s_instance = nullptr;
} }
bool RemoteClient::isActive() const bool RemoteClient::isActive() const

View File

@ -39,9 +39,9 @@ namespace QInstaller {
RemoteObject::RemoteObject(const QString &wrappedType, QObject *parent) RemoteObject::RemoteObject(const QString &wrappedType, QObject *parent)
: QObject(parent) : QObject(parent)
, dummy(0) , dummy(nullptr)
, m_type(wrappedType) , m_type(wrappedType)
, m_socket(0) , m_socket(nullptr)
{ {
Q_ASSERT_X(!m_type.isEmpty(), Q_FUNC_INFO, "The wrapped Qt type needs to be passed as " Q_ASSERT_X(!m_type.isEmpty(), Q_FUNC_INFO, "The wrapped Qt type needs to be passed as "
"argument and cannot be empty."); "argument and cannot be empty.");
@ -78,7 +78,7 @@ bool RemoteObject::authorize()
return true; return true;
} }
delete m_socket; delete m_socket;
m_socket = 0; m_socket = nullptr;
return false; return false;
} }

View File

@ -44,10 +44,10 @@ RemoteServerConnection::RemoteServerConnection(qintptr socketDescriptor, const Q
QObject *parent) QObject *parent)
: QThread(parent) : QThread(parent)
, m_socketDescriptor(socketDescriptor) , m_socketDescriptor(socketDescriptor)
, m_process(0) , m_process(nullptr)
, m_engine(0) , m_engine(nullptr)
, m_authorizationKey(key) , m_authorizationKey(key)
, m_signalReceiver(0) , m_signalReceiver(nullptr)
{ {
setObjectName(QString::fromLatin1("RemoteServerConnection(%1)").arg(socketDescriptor)); setObjectName(QString::fromLatin1("RemoteServerConnection(%1)").arg(socketDescriptor));
} }
@ -146,10 +146,10 @@ void RemoteServerConnection::run()
} else if (type == QLatin1String(Protocol::QProcess)) { } else if (type == QLatin1String(Protocol::QProcess)) {
m_signalReceiver->m_receivedSignals.clear(); m_signalReceiver->m_receivedSignals.clear();
m_process->deleteLater(); m_process->deleteLater();
m_process = 0; m_process = nullptr;
} else if (type == QLatin1String(Protocol::QAbstractFileEngine)) { } else if (type == QLatin1String(Protocol::QAbstractFileEngine)) {
delete m_engine; delete m_engine;
m_engine = 0; m_engine = nullptr;
} }
return; return;
} }

View File

@ -97,7 +97,7 @@ void QDesktopServicesProxy::findRecursion(const QString &path, const QString &pa
GuiProxy::GuiProxy(ScriptEngine *engine, QObject *parent) : GuiProxy::GuiProxy(ScriptEngine *engine, QObject *parent) :
QObject(parent), QObject(parent),
m_engine(engine), m_engine(engine),
m_gui(0) m_gui(nullptr)
{ {
} }

View File

@ -135,7 +135,7 @@ static QStringList readArgumentAttributes(QXmlStreamReader &reader, Settings::Pa
return arguments; return arguments;
} }
static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefault, Settings::ParseMode parseMode, QString *displayName = 0) static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefault, Settings::ParseMode parseMode, QString *displayName = nullptr)
{ {
qDebug()<<__FUNCTION__; qDebug()<<__FUNCTION__;
QSet<Repository> set; QSet<Repository> set;

View File

@ -57,7 +57,7 @@ VolumeInfo updateVolumeSizeInformation(const VolumeInfo &info)
ULARGE_INTEGER freeBytesPerUser; ULARGE_INTEGER freeBytesPerUser;
VolumeInfo update = info; VolumeInfo update = info;
if (GetDiskFreeSpaceExA(qPrintable(info.volumeDescriptor()), &freeBytesPerUser, &bytesTotal, NULL)) { if (GetDiskFreeSpaceExA(qPrintable(info.volumeDescriptor()), &freeBytesPerUser, &bytesTotal, nullptr)) {
update.setSize(bytesTotal.QuadPart); update.setSize(bytesTotal.QuadPart);
update.setAvailableSize(freeBytesPerUser.QuadPart); update.setAvailableSize(freeBytesPerUser.QuadPart);
} }
@ -197,7 +197,7 @@ bool killProcess(const ProcessInfo &process, int msecs)
// If we can't open the process with PROCESS_TERMINATE rights, then we give up immediately. // If we can't open the process with PROCESS_TERMINATE rights, then we give up immediately.
HANDLE hProc = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, false, process.id); HANDLE hProc = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, false, process.id);
if (hProc == 0) if (hProc == nullptr)
return false; return false;
// TerminateAppEnum() posts WM_CLOSE to all windows whose PID matches your process's. // TerminateAppEnum() posts WM_CLOSE to all windows whose PID matches your process's.

View File

@ -89,7 +89,7 @@ public:
m_futureInterface->waitForResume(); m_futureInterface->waitForResume();
COM_TRY_BEGIN COM_TRY_BEGIN
*outStream = 0; *outStream = nullptr;
m_currentIndex = index; m_currentIndex = index;
if (askExtractMode != NArchive::NExtract::NAskMode::kExtract) if (askExtractMode != NArchive::NExtract::NAskMode::kExtract)
return E_FAIL; return E_FAIL;
@ -160,8 +160,8 @@ public:
const bool writeCreationTime = GetTime(kpidCTime, &creationTime); const bool writeCreationTime = GetTime(kpidCTime, &creationTime);
const bool writeModificationTime = GetTime(kpidMTime, &modificationTime); const bool writeModificationTime = GetTime(kpidMTime, &modificationTime);
m_outFileStream->SetTime((writeCreationTime ? &creationTime : NULL), m_outFileStream->SetTime((writeCreationTime ? &creationTime : nullptr),
(writeAccessTime ? &accessTime : NULL), (writeModificationTime ? &modificationTime : NULL)); (writeAccessTime ? &accessTime : nullptr), (writeModificationTime ? &modificationTime : nullptr));
m_totalUnpacked += m_outFileStream->ProcessedSize; m_totalUnpacked += m_outFileStream->ProcessedSize;
m_outFileStream->Close(); m_outFileStream->Close();

View File

@ -85,16 +85,16 @@ bool QInstaller::startDetached(const QString &program, const QStringList &argume
bool success = false; bool success = false;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
PROCESS_INFORMATION pinfo; PROCESS_INFORMATION pinfo;
STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), 0, 0, 0, STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), nullptr, nullptr, nullptr,
static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT),
static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT),
0, 0, 0, STARTF_USESHOWWINDOW, SW_HIDE, 0, 0, 0, 0, 0 0, 0, 0, STARTF_USESHOWWINDOW, SW_HIDE, 0, nullptr, nullptr, nullptr, nullptr
}; // That's the difference over QProcess::startDetached(): STARTF_USESHOWWINDOW, SW_HIDE. }; // That's the difference over QProcess::startDetached(): STARTF_USESHOWWINDOW, SW_HIDE.
const QString commandline = QInstaller::createCommandline(program, arguments); const QString commandline = QInstaller::createCommandline(program, arguments);
if (CreateProcessW(0, (wchar_t*) commandline.utf16(), if (CreateProcessW(nullptr, (wchar_t*) commandline.utf16(),
0, 0, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, nullptr, nullptr, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE,
0, workingDirectory.isEmpty() ? 0 : (wchar_t*) workingDirectory.utf16(), nullptr, workingDirectory.isEmpty() ? nullptr : (wchar_t*) workingDirectory.utf16(),
&startupInfo, &pinfo)) { &startupInfo, &pinfo)) {
success = true; success = true;
CloseHandle(pinfo.hThread); CloseHandle(pinfo.hThread);
@ -244,7 +244,7 @@ bool QInstaller::VerboseWriter::flush(VerboseWriterOutput *output)
if (output->write(logFileName, QIODevice::ReadWrite | QIODevice::Append | QIODevice::Text, buffer.data())) { if (output->write(logFileName, QIODevice::ReadWrite | QIODevice::Append | QIODevice::Text, buffer.data())) {
preFileBuffer.close(); preFileBuffer.close();
stream.setDevice(0); stream.setDevice(nullptr);
return true; return true;
} }
return false; return false;
@ -341,7 +341,7 @@ static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc)
argv[argc++] = start; argv[argc++] = start;
} }
} }
argv[argc] = 0; argv[argc] = nullptr;
return argv; return argv;
} }
@ -419,14 +419,14 @@ QString QInstaller::createCommandline(const QString &program, const QStringList
QString QInstaller::windowsErrorString(int errorCode) QString QInstaller::windowsErrorString(int errorCode)
{ {
QString ret; QString ret;
wchar_t *string = 0; wchar_t *string = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, nullptr,
errorCode, errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR) &string, (LPWSTR) &string,
0, 0,
NULL); nullptr);
ret = QString::fromWCharArray(string); ret = QString::fromWCharArray(string);
LocalFree((HLOCAL) string); LocalFree((HLOCAL) string);

View File

@ -46,7 +46,7 @@
static bool isRedirected(HANDLE stdHandle) static bool isRedirected(HANDLE stdHandle)
{ {
if (stdHandle == NULL) // launched from GUI if (stdHandle == nullptr) // launched from GUI
return false; return false;
DWORD fileType = GetFileType(stdHandle); DWORD fileType = GetFileType(stdHandle);
if (fileType == FILE_TYPE_UNKNOWN) { if (fileType == FILE_TYPE_UNKNOWN) {
@ -73,8 +73,8 @@ static bool isRedirected(HANDLE stdHandle)
* (e.g. into a file), Console does not interfere. * (e.g. into a file), Console does not interfere.
*/ */
Console::Console() : Console::Console() :
m_oldCout(0), m_oldCout(nullptr),
m_oldCerr(0) m_oldCerr(nullptr)
{ {
bool isCoutRedirected = isRedirected(GetStdHandle(STD_OUTPUT_HANDLE)); bool isCoutRedirected = isRedirected(GetStdHandle(STD_OUTPUT_HANDLE));
bool isCerrRedirected = isRedirected(GetStdHandle(STD_ERROR_HANDLE)); bool isCerrRedirected = isRedirected(GetStdHandle(STD_ERROR_HANDLE));
@ -97,7 +97,7 @@ Console::Console() :
| ENABLE_EXTENDED_FLAGS); | ENABLE_EXTENDED_FLAGS);
# ifndef Q_CC_MINGW # ifndef Q_CC_MINGW
HMENU systemMenu = GetSystemMenu(GetConsoleWindow(), FALSE); HMENU systemMenu = GetSystemMenu(GetConsoleWindow(), FALSE);
if (systemMenu != NULL) if (systemMenu != nullptr)
RemoveMenu(systemMenu, SC_CLOSE, MF_BYCOMMAND); RemoveMenu(systemMenu, SC_CLOSE, MF_BYCOMMAND);
DrawMenuBar(GetConsoleWindow()); DrawMenuBar(GetConsoleWindow());
# endif # endif

View File

@ -64,7 +64,7 @@
InstallerBase::InstallerBase(int &argc, char *argv[]) InstallerBase::InstallerBase(int &argc, char *argv[])
: SDKApp<QApplication>(argc, argv) : SDKApp<QApplication>(argc, argv)
, m_core(0) , m_core(nullptr)
{ {
QInstaller::init(); // register custom operations QInstaller::init(); // register custom operations
} }
@ -87,7 +87,7 @@ int InstallerBase::run()
// just silently ignore the fact that we could not create the lock file // just silently ignore the fact that we could not create the lock file
// and check the running processes. // and check the running processes.
if (runCheck.isRunning(RunOnceChecker::ConditionFlag::ProcessList)) { if (runCheck.isRunning(RunOnceChecker::ConditionFlag::ProcessList)) {
QInstaller::MessageBoxHandler::information(0, QLatin1String("AlreadyRunning"), QInstaller::MessageBoxHandler::information(nullptr, QLatin1String("AlreadyRunning"),
tr("Waiting for %1").arg(qAppName()), tr("Waiting for %1").arg(qAppName()),
tr("Another %1 instance is already running. Wait " tr("Another %1 instance is already running. Wait "
"until it finishes, close it, or restart your system.").arg(qAppName())); "until it finishes, close it, or restart your system.").arg(qAppName()));
@ -304,7 +304,7 @@ int InstallerBase::run()
} }
else { else {
//create the wizard GUI //create the wizard GUI
TabController controller(0); TabController controller(nullptr);
controller.setManager(m_core); controller.setManager(m_core);
controller.setControlScript(controlScript); controller.setControlScript(controlScript);
if (m_core->isInstaller()) if (m_core->isInstaller())

View File

@ -39,7 +39,7 @@ using namespace QInstaller;
// -- InstallerGui // -- InstallerGui
InstallerGui::InstallerGui(PackageManagerCore *core) InstallerGui::InstallerGui(PackageManagerCore *core)
: PackageManagerGui(core, 0) : PackageManagerGui(core, nullptr)
{ {
ProductKeyCheck *checker = ProductKeyCheck::instance(); ProductKeyCheck *checker = ProductKeyCheck::instance();
foreach (const int id, checker->registeredPages()) { foreach (const int id, checker->registeredPages()) {
@ -71,7 +71,7 @@ InstallerGui::InstallerGui(PackageManagerCore *core)
// -- MaintenanceGui // -- MaintenanceGui
MaintenanceGui::MaintenanceGui(PackageManagerCore *core) MaintenanceGui::MaintenanceGui(PackageManagerCore *core)
: PackageManagerGui(core, 0) : PackageManagerGui(core, nullptr)
{ {
ProductKeyCheck *checker = ProductKeyCheck::instance(); ProductKeyCheck *checker = ProductKeyCheck::instance();
foreach (const int id, checker->registeredPages()) { foreach (const int id, checker->registeredPages()) {

View File

@ -67,7 +67,7 @@ QWidget *PasswordDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
const const
{ {
if (m_disabledEditor) if (m_disabledEditor)
return 0; return nullptr;
QLineEdit *lineEdit = new QLineEdit(parent); QLineEdit *lineEdit = new QLineEdit(parent);
lineEdit->setEchoMode(m_showPasswords ? QLineEdit::Normal : QLineEdit::Password); lineEdit->setEchoMode(m_showPasswords ? QLineEdit::Normal : QLineEdit::Password);

View File

@ -61,8 +61,8 @@ public:
TabController::Private::Private() TabController::Private::Private()
: m_init(false) : m_init(false)
, m_networkSettingsChanged(false) , m_networkSettingsChanged(false)
, m_gui(0) , m_gui(nullptr)
, m_core(0) , m_core(nullptr)
{ {
} }

View File

@ -52,7 +52,7 @@ class TestOperation : public KDUpdater::UpdateOperation
{ {
public: public:
TestOperation(const QString &name) TestOperation(const QString &name)
: KDUpdater::UpdateOperation(0) : KDUpdater::UpdateOperation(nullptr)
{ setName(name); } { setName(name); }
virtual void backup() {} virtual void backup() {}

View File

@ -62,7 +62,7 @@ private slots:
void testMissingArguments() void testMissingArguments()
{ {
ConsumeOutputOperation operation(0); ConsumeOutputOperation operation(nullptr);
QVERIFY(operation.testOperation()); QVERIFY(operation.testOperation());
QVERIFY(!operation.performOperation()); QVERIFY(!operation.performOperation());

View File

@ -48,7 +48,7 @@ private slots:
void testMissingArguments() void testMissingArguments()
{ {
ExtractArchiveOperation op(0); ExtractArchiveOperation op(nullptr);
QVERIFY(op.testOperation()); QVERIFY(op.testOperation());
QVERIFY(!op.performOperation()); QVERIFY(!op.performOperation());
@ -62,7 +62,7 @@ private slots:
void testExtractOperationValidFile() void testExtractOperationValidFile()
{ {
ExtractArchiveOperation op(0); ExtractArchiveOperation op(nullptr);
op.setArguments(QStringList() << ":///data/valid.7z" << QDir::tempPath()); op.setArguments(QStringList() << ":///data/valid.7z" << QDir::tempPath());
QVERIFY(op.testOperation()); QVERIFY(op.testOperation());
@ -72,7 +72,7 @@ private slots:
void testExtractOperationInvalidFile() void testExtractOperationInvalidFile()
{ {
ExtractArchiveOperation op(0); ExtractArchiveOperation op(nullptr);
op.setArguments(QStringList() << ":///data/invalid.7z" << QDir::tempPath()); op.setArguments(QStringList() << ":///data/invalid.7z" << QDir::tempPath());
QVERIFY(op.testOperation()); QVERIFY(op.testOperation());

View File

@ -28,7 +28,7 @@ private slots:
void testMissingPackageManagerCore() void testMissingPackageManagerCore()
{ {
FakeStopProcessForUpdateOperation op(0); FakeStopProcessForUpdateOperation op(nullptr);
op.setArguments(QStringList() << QFileInfo(QCoreApplication::applicationFilePath()).fileName()); op.setArguments(QStringList() << QFileInfo(QCoreApplication::applicationFilePath()).fileName());
QVERIFY(op.testOperation()); QVERIFY(op.testOperation());

View File

@ -60,7 +60,7 @@ private slots:
void testWrongArguments() void testWrongArguments()
{ {
SettingsOperation noArgumentsOperation(0); SettingsOperation noArgumentsOperation(nullptr);
QVERIFY(noArgumentsOperation.testOperation()); QVERIFY(noArgumentsOperation.testOperation());
@ -76,7 +76,7 @@ private slots:
// same for undo // same for undo
QCOMPARE(noArgumentsOperation.undoOperation(), false); QCOMPARE(noArgumentsOperation.undoOperation(), false);
SettingsOperation wrongMethodArgumentOperation(0); SettingsOperation wrongMethodArgumentOperation(nullptr);
wrongMethodArgumentOperation.setArguments(QStringList() << "path=first" << "method=second" wrongMethodArgumentOperation.setArguments(QStringList() << "path=first" << "method=second"
<< "key=third" << "value=fourth"); << "key=third" << "value=fourth");
@ -109,7 +109,7 @@ private slots:
testSettings.setValue(key, value); testSettings.setValue(key, value);
} }
SettingsOperation settingsOperation(0); SettingsOperation settingsOperation(nullptr);
settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) << settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) <<
"method=set" << QString("key=%1").arg(key) << QString("value=%1").arg(value)); "method=set" << QString("key=%1").arg(key) << QString("value=%1").arg(value));
settingsOperation.backup(); settingsOperation.backup();
@ -127,7 +127,7 @@ private slots:
const QString key = "key"; const QString key = "key";
const QString value = "value"; const QString value = "value";
SettingsOperation settingsOperation(0); SettingsOperation settingsOperation(nullptr);
settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) << settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) <<
"method=set" << QString("key=%1").arg(key) << QString("value=%1").arg(value)); "method=set" << QString("key=%1").arg(key) << QString("value=%1").arg(value));
settingsOperation.backup(); settingsOperation.backup();
@ -154,7 +154,7 @@ private slots:
} }
QCOMPARE(testValueString.isEmpty(), false); QCOMPARE(testValueString.isEmpty(), false);
SettingsOperation settingsOperation(0); SettingsOperation settingsOperation(nullptr);
settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) << settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) <<
"method=remove" << QString("key=%1").arg(key)); "method=remove" << QString("key=%1").arg(key));
settingsOperation.backup(); settingsOperation.backup();
@ -189,10 +189,10 @@ private slots:
testFile.close(); testFile.close();
QMap<QString, SettingsOperation*> testSettingsOperationMap; QMap<QString, SettingsOperation*> testSettingsOperationMap;
testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation(0); testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation(nullptr);
testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation(0); testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation(nullptr);
testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation(0); testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation(nullptr);
testSettingsOperationMap["testcategory/categoryarrayvalue4"] = new SettingsOperation(0); testSettingsOperationMap["testcategory/categoryarrayvalue4"] = new SettingsOperation(nullptr);
QMap<QString, SettingsOperation*>::iterator i = testSettingsOperationMap.begin(); QMap<QString, SettingsOperation*>::iterator i = testSettingsOperationMap.begin();
while (i != testSettingsOperationMap.end()) { while (i != testSettingsOperationMap.end()) {
@ -256,9 +256,9 @@ private slots:
testFile.close(); testFile.close();
QMap<QString, SettingsOperation*> testSettingsOperationMap; QMap<QString, SettingsOperation*> testSettingsOperationMap;
testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation(0); testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation(nullptr);
testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation(0); testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation(nullptr);
testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation(0); testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation(nullptr);
QMap<QString, SettingsOperation*>::iterator i = testSettingsOperationMap.begin(); QMap<QString, SettingsOperation*>::iterator i = testSettingsOperationMap.begin();
while (i != testSettingsOperationMap.end()) { while (i != testSettingsOperationMap.end()) {

View File

@ -49,7 +49,7 @@ void EnvironmentVariableTest::testPersistentNonSystem()
#endif #endif
QString key = QLatin1String("IFW_TestKey"); QString key = QLatin1String("IFW_TestKey");
QString value = QLatin1String("IFW_TestValue"); QString value = QLatin1String("IFW_TestValue");
QInstaller::EnvironmentVariableOperation op(0); QInstaller::EnvironmentVariableOperation op(nullptr);
op.setArguments( QStringList() << key op.setArguments( QStringList() << key
<< value << value
<< QLatin1String("true") << QLatin1String("true")
@ -77,7 +77,7 @@ void EnvironmentVariableTest::testNonPersistentNonSystem()
#endif #endif
QString key = QLatin1String("IFW_TestKey"); QString key = QLatin1String("IFW_TestKey");
QString value = QLatin1String("IFW_TestValue"); QString value = QLatin1String("IFW_TestValue");
QInstaller::EnvironmentVariableOperation op(0); QInstaller::EnvironmentVariableOperation op(nullptr);
op.setArguments( QStringList() << key op.setArguments( QStringList() << key
<< value << value
<< QLatin1String("false") << QLatin1String("false")

View File

@ -546,7 +546,7 @@ QT_END_NAMESPACE
static int runRcc(const QStringList &args) static int runRcc(const QStringList &args)
{ {
const int argc = args.count(); const int argc = args.count();
QVector<char*> argv(argc, 0); QVector<char*> argv(argc, nullptr);
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
argv[i] = qstrdup(qPrintable(args[i])); argv[i] = qstrdup(qPrintable(args[i]));

View File

@ -126,7 +126,7 @@ RCCFileInfo::RCCFileInfo(const QString &name, const QFileInfo &fileInfo,
m_language = language; m_language = language;
m_country = country; m_country = country;
m_flags = flags; m_flags = flags;
m_parent = 0; m_parent = nullptr;
m_nameOffset = 0; m_nameOffset = 0;
m_dataOffset = 0; m_dataOffset = 0;
m_childOffset = 0; m_childOffset = 0;
@ -325,7 +325,7 @@ RCCResourceLibrary::Strings::Strings() :
} }
RCCResourceLibrary::RCCResourceLibrary() RCCResourceLibrary::RCCResourceLibrary()
: m_root(0), : m_root(nullptr),
m_format(C_Code), m_format(C_Code),
m_verbose(false), m_verbose(false),
m_compressLevel(CONSTANT_COMPRESSLEVEL_DEFAULT), m_compressLevel(CONSTANT_COMPRESSLEVEL_DEFAULT),
@ -334,7 +334,7 @@ RCCResourceLibrary::RCCResourceLibrary()
m_namesOffset(0), m_namesOffset(0),
m_dataOffset(0), m_dataOffset(0),
m_useNameSpace(CONSTANT_USENAMESPACE), m_useNameSpace(CONSTANT_USENAMESPACE),
m_errorDevice(0) m_errorDevice(nullptr)
{ {
m_out.reserve(30 * 1000 * 1000); m_out.reserve(30 * 1000 * 1000);
} }
@ -550,7 +550,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
return false; return false;
} }
if (m_root == 0) { if (m_root == nullptr) {
const QString msg = QString::fromUtf8("RCC: Warning: No resources in '%1'.\n").arg(fname); const QString msg = QString::fromUtf8("RCC: Warning: No resources in '%1'.\n").arg(fname);
m_errorDevice->write(msg.toUtf8()); m_errorDevice->write(msg.toUtf8());
if (!ignoreErrors && m_format == Binary) { if (!ignoreErrors && m_format == Binary) {
@ -606,9 +606,9 @@ void RCCResourceLibrary::reset()
{ {
if (m_root) { if (m_root) {
delete m_root; delete m_root;
m_root = 0; m_root = nullptr;
} }
m_errorDevice = 0; m_errorDevice = nullptr;
m_failedResources.clear(); m_failedResources.clear();
} }

View File

@ -54,7 +54,7 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
} }
} }
QInstaller::CopyDirectoryOperation copyMetadata(0); QInstaller::CopyDirectoryOperation copyMetadata(nullptr);
copyMetadata.setArguments(QStringList() << QLatin1String(":/") copyMetadata.setArguments(QStringList() << QLatin1String(":/")
<< (targetDir.path() + QLatin1Char('/'))); // Add "/" at the end to make operation work. << (targetDir.path() + QLatin1Char('/'))); // Add "/" at the end to make operation work.
if (!copyMetadata.performOperation()) { if (!copyMetadata.performOperation()) {

View File

@ -71,7 +71,7 @@ void RepositoryManager::setProductionRepository(const QString &repo)
{ {
QUrl url(repo); QUrl url(repo);
if (!url.isValid()) { if (!url.isValid()) {
QMessageBox::critical(0, QLatin1String("Error"), QLatin1String("Specified URL is not valid")); QMessageBox::critical(nullptr, QLatin1String("Error"), QLatin1String("Specified URL is not valid"));
return; return;
} }
@ -83,7 +83,7 @@ void RepositoryManager::setUpdateRepository(const QString &repo)
{ {
QUrl url(repo); QUrl url(repo);
if (!url.isValid()) { if (!url.isValid()) {
QMessageBox::critical(0, QLatin1String("Error"), QLatin1String("Specified URL is not valid")); QMessageBox::critical(nullptr, QLatin1String("Error"), QLatin1String("Specified URL is not valid"));
return; return;
} }
@ -181,7 +181,7 @@ void RepositoryManager::writeUpdateFile(const QString &fileName)
{ {
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
QMessageBox::critical(0, QLatin1String("Error"), QMessageBox::critical(nullptr, QLatin1String("Error"),
QString::fromLatin1("Cannot open file \"%1\" for writing: %2").arg( QString::fromLatin1("Cannot open file \"%1\" for writing: %2").arg(
QDir::toNativeSeparators(fileName), file.errorString())); QDir::toNativeSeparators(fileName), file.errorString()));
return; return;