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)
{
Q_ASSERT(resource);
resource->setParent(0);
resource->setParent(nullptr);
m_resources.append(resource);
}

View File

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

View File

@ -48,7 +48,7 @@ namespace QInstaller {
QAbstractFileEngine *BinaryFormatEngineHandler::create(const QString &fileName) const
{
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)
: q(qq)
, m_core(core)
, m_parentComponent(0)
, m_licenseOperation(0)
, m_minimumProgressOperation(0)
, m_parentComponent(nullptr)
, m_licenseOperation(nullptr)
, m_minimumProgressOperation(nullptr)
, m_newlyInstalled (false)
, m_operationsCreated(false)
, m_autoCreateOperations(true)
@ -98,11 +98,11 @@ int ComponentModelHelper::childCount() const
Component *ComponentModelHelper::childAt(int index) const
{
if (index < 0 && index >= childCount())
return 0;
return nullptr;
if (m_componentPrivate->m_core->virtualComponentsVisible())
return m_componentPrivate->m_allChildComponents.value(index, 0);
return m_componentPrivate->m_childComponents.value(index, 0);
return m_componentPrivate->m_allChildComponents.value(index, nullptr);
return m_componentPrivate->m_childComponents.value(index, nullptr);
}
/*!

View File

@ -378,7 +378,7 @@ Component *ComponentModel::componentFromIndex(const QModelIndex &index) const
{
if (index.isValid())
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) {
QString defaultDownloadDirectory =
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
QStringList fileNames = QFileDialog::getOpenFileNames(NULL,
QStringList fileNames = QFileDialog::getOpenFileNames(nullptr,
ComponentSelectionPage::tr("Open File"),defaultDownloadDirectory,
QLatin1String("QBSP or 7z Files (*.qbsp *.7z)"));

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@ using namespace KDUpdater;
DownloadArchivesJob::DownloadArchivesJob(PackageManagerCore *core)
: Job(core)
, m_core(core)
, m_downloader(0)
, m_downloader(nullptr)
, m_archivesDownloaded(0)
, m_archivesToDownloadCount(0)
, m_canceled(false)
@ -93,7 +93,7 @@ void DownloadArchivesJob::doStart()
void DownloadArchivesJob::doCancel()
{
m_canceled = true;
if (m_downloader != 0)
if (m_downloader != nullptr)
m_downloader->cancelDownload();
}
@ -130,7 +130,7 @@ void DownloadArchivesJob::fetchNextArchiveHash()
void DownloadArchivesJob::finishedHashDownload()
{
Q_ASSERT(m_downloader != 0);
Q_ASSERT(m_downloader != nullptr);
QFile sha1HashFile(m_downloader->downloadedFileName());
if (sha1HashFile.open(QFile::ReadOnly)) {
@ -156,7 +156,7 @@ void DownloadArchivesJob::fetchNextArchive()
return;
}
if (m_downloader != 0)
if (m_downloader != nullptr)
m_downloader->deleteLater();
m_downloader = setupDownloader(QString(), m_core->value(scUrlQueryString));
@ -202,7 +202,7 @@ void DownloadArchivesJob::timerEvent(QTimerEvent *event)
*/
void DownloadArchivesJob::registerFile()
{
Q_ASSERT(m_downloader != 0);
Q_ASSERT(m_downloader != nullptr);
if (m_canceled)
return;
@ -259,7 +259,7 @@ void DownloadArchivesJob::finishWithError(const QString &error)
{
const FileDownloader *const dl = qobject_cast<const FileDownloader*> (sender());
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()));
else
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 *downloader = 0;
KDUpdater::FileDownloader *downloader = nullptr;
const QFileInfo fi = QFileInfo(m_archivesToDownload.first().first);
const Component *const component = m_core->componentByName(PackageManagerCore::checkableName(QFileInfo(fi.path()).fileName()));
if (component) {

View File

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

View File

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

View File

@ -239,7 +239,7 @@ void QInstaller::removeDirectory(const QString &path, bool ignoreErrors)
class RemoveDirectoryThread : public QThread
{
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)
, p(path)
, ignore(ignoreErrors)
@ -411,7 +411,7 @@ QString QInstaller::getShortPathName(const QString &name)
// Determine length, then convert.
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)
return name;
QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]);
@ -427,7 +427,7 @@ QString QInstaller::getLongPathName(const QString &name)
// Determine length, then convert.
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)
return name;
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)
{
if (!checkArgumentCount(3, 5))
return 0;
return nullptr;
if (arguments.count() == 5) {
QSettingsWrapper::Scope scope = QSettingsWrapper::UserScope;
@ -120,5 +120,5 @@ QSettingsWrapper *GlobalSettingsOperation::setup(QString *key, QString *value, c
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;
if (type == QtFatalMsg) {
QtMessageHandler oldMsgHandler = qInstallMessageHandler(0);
QtMessageHandler oldMsgHandler = qInstallMessageHandler(nullptr);
qt_message_output(type, context, msg);
qInstallMessageHandler(oldMsgHandler);
}

View File

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

View File

@ -64,7 +64,7 @@
#include <memory>
#ifdef Q_OS_WIN
HINSTANCE g_hInstance = 0;
HINSTANCE g_hInstance = nullptr;
# define S_IFMT 00170000
# 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)
{
quint32 attributes = getUInt32Property(archive, index, kpidAttrib, 0);
QFile::Permissions permissions = 0;
QFile::Permissions permissions = nullptr;
if (attributes & FILE_ATTRIBUTE_UNIX_EXTENSION) {
if (hasPermissions != 0)
if (hasPermissions != nullptr)
*hasPermissions = true;
// filter the Unix permissions
attributes = (attributes >> 16) & 0777;
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 & 0007) << 0); // and world rights
} else if (hasPermissions != 0) {
} else if (hasPermissions != nullptr) {
*hasPermissions = false;
}
return permissions;
@ -536,7 +536,7 @@ QVector<File> listArchive(QFileDevice *archive)
f.archiveIndex.setY(item);
f.path = UString2QString(s).replace(QLatin1Char('\\'), QLatin1Char('/'));
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));
f.uncompressedSize = getUInt64Property(arch, item, kpidSize, 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.
STDMETHODIMP ExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 /*askExtractMode*/)
{
*outStream = 0;
*outStream = nullptr;
if (targetDir.isEmpty())
return E_FAIL;
@ -790,14 +790,14 @@ HRESULT UpdateCallback::OpenFileError(const wchar_t*, DWORD)
HRESULT UpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
*password = 0;
*password = nullptr;
*passwordIsDefined = false;
return S_OK;
}
HRESULT UpdateCallback::CryptoGetTextPassword(BSTR *password)
{
*password = 0;
*password = nullptr;
return E_NOTIMPL;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,9 +39,9 @@ namespace QInstaller {
RemoteObject::RemoteObject(const QString &wrappedType, QObject *parent)
: QObject(parent)
, dummy(0)
, dummy(nullptr)
, 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 "
"argument and cannot be empty.");
@ -78,7 +78,7 @@ bool RemoteObject::authorize()
return true;
}
delete m_socket;
m_socket = 0;
m_socket = nullptr;
return false;
}

View File

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

View File

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

View File

@ -135,7 +135,7 @@ static QStringList readArgumentAttributes(QXmlStreamReader &reader, Settings::Pa
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__;
QSet<Repository> set;

View File

@ -57,7 +57,7 @@ VolumeInfo updateVolumeSizeInformation(const VolumeInfo &info)
ULARGE_INTEGER freeBytesPerUser;
VolumeInfo update = info;
if (GetDiskFreeSpaceExA(qPrintable(info.volumeDescriptor()), &freeBytesPerUser, &bytesTotal, NULL)) {
if (GetDiskFreeSpaceExA(qPrintable(info.volumeDescriptor()), &freeBytesPerUser, &bytesTotal, nullptr)) {
update.setSize(bytesTotal.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.
HANDLE hProc = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, false, process.id);
if (hProc == 0)
if (hProc == nullptr)
return false;
// TerminateAppEnum() posts WM_CLOSE to all windows whose PID matches your process's.

View File

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

View File

@ -85,16 +85,16 @@ bool QInstaller::startDetached(const QString &program, const QStringList &argume
bool success = false;
#ifdef Q_OS_WIN
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),
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.
const QString commandline = QInstaller::createCommandline(program, arguments);
if (CreateProcessW(0, (wchar_t*) commandline.utf16(),
0, 0, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE,
0, workingDirectory.isEmpty() ? 0 : (wchar_t*) workingDirectory.utf16(),
if (CreateProcessW(nullptr, (wchar_t*) commandline.utf16(),
nullptr, nullptr, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE,
nullptr, workingDirectory.isEmpty() ? nullptr : (wchar_t*) workingDirectory.utf16(),
&startupInfo, &pinfo)) {
success = true;
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())) {
preFileBuffer.close();
stream.setDevice(0);
stream.setDevice(nullptr);
return true;
}
return false;
@ -341,7 +341,7 @@ static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc)
argv[argc++] = start;
}
}
argv[argc] = 0;
argv[argc] = nullptr;
return argv;
}
@ -419,14 +419,14 @@ QString QInstaller::createCommandline(const QString &program, const QStringList
QString QInstaller::windowsErrorString(int errorCode)
{
QString ret;
wchar_t *string = 0;
wchar_t *string = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
nullptr,
errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR) &string,
0,
NULL);
nullptr);
ret = QString::fromWCharArray(string);
LocalFree((HLOCAL) string);

View File

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

View File

@ -64,7 +64,7 @@
InstallerBase::InstallerBase(int &argc, char *argv[])
: SDKApp<QApplication>(argc, argv)
, m_core(0)
, m_core(nullptr)
{
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
// and check the running processes.
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("Another %1 instance is already running. Wait "
"until it finishes, close it, or restart your system.").arg(qAppName()));
@ -304,7 +304,7 @@ int InstallerBase::run()
}
else {
//create the wizard GUI
TabController controller(0);
TabController controller(nullptr);
controller.setManager(m_core);
controller.setControlScript(controlScript);
if (m_core->isInstaller())

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -546,7 +546,7 @@ QT_END_NAMESPACE
static int runRcc(const QStringList &args)
{
const int argc = args.count();
QVector<char*> argv(argc, 0);
QVector<char*> argv(argc, nullptr);
for (int i = 0; i < argc; ++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_country = country;
m_flags = flags;
m_parent = 0;
m_parent = nullptr;
m_nameOffset = 0;
m_dataOffset = 0;
m_childOffset = 0;
@ -325,7 +325,7 @@ RCCResourceLibrary::Strings::Strings() :
}
RCCResourceLibrary::RCCResourceLibrary()
: m_root(0),
: m_root(nullptr),
m_format(C_Code),
m_verbose(false),
m_compressLevel(CONSTANT_COMPRESSLEVEL_DEFAULT),
@ -334,7 +334,7 @@ RCCResourceLibrary::RCCResourceLibrary()
m_namesOffset(0),
m_dataOffset(0),
m_useNameSpace(CONSTANT_USENAMESPACE),
m_errorDevice(0)
m_errorDevice(nullptr)
{
m_out.reserve(30 * 1000 * 1000);
}
@ -550,7 +550,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
return false;
}
if (m_root == 0) {
if (m_root == nullptr) {
const QString msg = QString::fromUtf8("RCC: Warning: No resources in '%1'.\n").arg(fname);
m_errorDevice->write(msg.toUtf8());
if (!ignoreErrors && m_format == Binary) {
@ -606,9 +606,9 @@ void RCCResourceLibrary::reset()
{
if (m_root) {
delete m_root;
m_root = 0;
m_root = nullptr;
}
m_errorDevice = 0;
m_errorDevice = nullptr;
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(":/")
<< (targetDir.path() + QLatin1Char('/'))); // Add "/" at the end to make operation work.
if (!copyMetadata.performOperation()) {

View File

@ -71,7 +71,7 @@ void RepositoryManager::setProductionRepository(const QString &repo)
{
QUrl url(repo);
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;
}
@ -83,7 +83,7 @@ void RepositoryManager::setUpdateRepository(const QString &repo)
{
QUrl url(repo);
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;
}
@ -181,7 +181,7 @@ void RepositoryManager::writeUpdateFile(const QString &fileName)
{
QFile file(fileName);
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(
QDir::toNativeSeparators(fileName), file.errorString()));
return;