Commit be841a42 authored by Alexander Bikadorov's avatar Alexander Bikadorov
Browse files

Replaced all null pointer constants with C++11 'nullptr' keyword

Auto-correction using "clang-tidy -fix ...".
parent 796b33f0
......@@ -77,7 +77,7 @@ static const unsigned char zisofs_magic[8] = {
kio_isoProtocol::kio_isoProtocol(const QByteArray &pool, const QByteArray &app) : SlaveBase("iso", pool, app)
{
//qDebug() << "kio_isoProtocol::kio_isoProtocol" << endl;
m_isoFile = 0L;
m_isoFile = nullptr;
}
kio_isoProtocol::~kio_isoProtocol()
......@@ -115,7 +115,7 @@ bool kio_isoProtocol::checkNewFile(QString fullPath, QString & path, int startse
if (m_isoFile) {
m_isoFile->close();
delete m_isoFile;
m_isoFile = 0L;
m_isoFile = nullptr;
}
// Find where the iso file is in the full path
......@@ -174,7 +174,7 @@ bool kio_isoProtocol::checkNewFile(QString fullPath, QString & path, int startse
if (!m_isoFile->open(QIODevice::ReadOnly)) {
//qDebug() << "Opening " << isoFile << " failed." << endl;
delete m_isoFile;
m_isoFile = 0L;
m_isoFile = nullptr;
return false;
}
......@@ -234,7 +234,7 @@ void kio_isoProtocol::listDir(const QUrl &url)
finished();
// And let go of the iso file - for people who want to unmount a cdrom after that
delete m_isoFile;
m_isoFile = 0L;
m_isoFile = nullptr;
return;
}
......@@ -316,7 +316,7 @@ void kio_isoProtocol::stat(const QUrl &url)
// And let go of the iso file - for people who want to unmount a cdrom after that
delete m_isoFile;
m_isoFile = 0L;
m_isoFile = nullptr;
return;
}
......@@ -342,7 +342,7 @@ void kio_isoProtocol::getFile(const KIsoFile *isoFileEntry, const QString &path)
unsigned long long size, pos = 0;
bool mime = false, zlib = false;
QByteArray fileData, pointer_block, inbuf, outbuf;
char *pptr = 0;
char *pptr = nullptr;
compressed_file_header *hdr;
int block_shift;
unsigned long nblocks;
......
......@@ -107,7 +107,7 @@ public:
};
KIso::KIso(const QString& filename, const QString & _mimetype)
: KArchive(0L)
: KArchive(nullptr)
{
KRFUNC;
KRDEBUG("Starting KIso: " << filename << " - type: " << _mimetype);
......@@ -236,7 +236,7 @@ static int mycallb(struct iso_directory_record *idr, void *udata)
int time, cdate, adate;
rr_entry rr;
bool special = false;
KArchiveEntry *entry = NULL, *oldentry = NULL;
KArchiveEntry *entry = nullptr, *oldentry = nullptr;
char z_algo[2], z_params[2];
long long z_size = 0;
......
......@@ -139,8 +139,8 @@ extern "C"
#ifdef KRARC_ENABLED
kio_krarcProtocol::kio_krarcProtocol(const QByteArray &pool_socket, const QByteArray &app_socket)
: SlaveBase("kio_krarc", pool_socket, app_socket), archiveChanged(true), arcFile(0L), extArcReady(false),
password(QString()), krConf("krusaderrc"), codec(0)
: SlaveBase("kio_krarc", pool_socket, app_socket), archiveChanged(true), arcFile(nullptr), extArcReady(false),
password(QString()), krConf("krusaderrc"), codec(nullptr)
{
KRFUNC;
confGrp = KConfigGroup(&krConf, "Dependencies");
......@@ -874,7 +874,7 @@ bool kio_krarcProtocol::setArcFile(const QUrl &url)
KRFUNC;
KRDEBUG(url.fileName());
QString path = getPath(url);
time_t currTime = time(0);
time_t currTime = time(nullptr);
archiveChanged = true;
newArchiveURL = true;
// is the file already set ?
......@@ -886,7 +886,7 @@ bool kio_krarcProtocol::setArcFile(const QUrl &url)
currentCharset = metaData("Charset");
codec = QTextCodec::codecForName(currentCharset.toLatin1());
if (codec == 0)
if (codec == nullptr)
codec = QTextCodec::codecForMib(4 /* latin-1 */);
delete arcFile;
......@@ -908,7 +908,7 @@ bool kio_krarcProtocol::setArcFile(const QUrl &url)
if (arcFile) {
delete arcFile;
password.clear();
arcFile = 0L;
arcFile = nullptr;
}
QString newPath = path;
if (newPath.right(1) != DIR_SEPARATOR) newPath = newPath + DIR_SEPARATOR;
......@@ -929,7 +929,7 @@ bool kio_krarcProtocol::setArcFile(const QUrl &url)
currentCharset = metaData("Charset");
codec = QTextCodec::codecForName(currentCharset.toLatin1());
if (codec == 0)
if (codec == nullptr)
codec = QTextCodec::codecForMib(4 /* latin-1 */);
}
......@@ -1116,11 +1116,11 @@ UDSEntry* kio_krarcProtocol::findFileEntry(const QUrl &url)
{
KRFUNC;
QString arcDir = findArcDirectory(url);
if (arcDir.isEmpty()) return 0;
if (arcDir.isEmpty()) return nullptr;
QHash<QString, KIO::UDSEntryList *>::iterator itef = dirDict.find(arcDir);
if (itef == dirDict.end())
return 0;
return nullptr;
UDSEntryList* dirList = itef.value();
QString name = getPath(url);
......@@ -1137,7 +1137,7 @@ UDSEntry* kio_krarcProtocol::findFileEntry(const QUrl &url)
(entry->stringValue(KIO::UDSEntry::UDS_NAME) == name))
return &(*entry);
}
return 0;
return nullptr;
}
QString kio_krarcProtocol::nextWord(QString &s, char d)
......@@ -1231,7 +1231,7 @@ void kio_krarcProtocol::parseLine(int lineNo, QString line)
QString perm;
mode_t mode = 0666;
size_t size = 0;
time_t time = ::time(0);
time_t time = ::time(nullptr);
QString fullName;
if (arcType == "zip") {
......@@ -1322,7 +1322,7 @@ void kio_krarcProtocol::parseLine(int lineNo, QString line)
// next field is md5sum, ignore it
nextWord(line);
// permissions
mode = nextWord(line).toULong(0, 8);
mode = nextWord(line).toULong(nullptr, 8);
// Owner & Group
owner = nextWord(line);
group = nextWord(line);
......
......@@ -68,7 +68,7 @@ protected:
virtual bool setArcFile(const QUrl &url);
virtual QString getPassword();
virtual void invalidatePassword();
QString getPath(const QUrl &url, QUrl::FormattingOptions options = 0);
QString getPath(const QUrl &url, QUrl::FormattingOptions options = nullptr);
QString localeEncodedString(QString str);
QByteArray encodeString(QString);
......
......@@ -33,7 +33,7 @@ class ActionMan : public QDialog
{
Q_OBJECT
public:
explicit ActionMan(QWidget* parent = 0);
explicit ActionMan(QWidget* parent = nullptr);
~ActionMan();
protected slots:
......
......@@ -105,7 +105,7 @@ void ActionProperty::changedShortcut(const QKeySequence& shortcut)
void ActionProperty::clear()
{
_action = 0;
_action = nullptr;
// This prevents the changed-signal from being emitted during the GUI-update
_modified = true; // The real state is set at the end of this function.
......@@ -338,7 +338,7 @@ void ActionProperty::newProtocol()
void ActionProperty::editProtocol()
{
if (lbShowonlyProtocol->currentItem() == 0)
if (lbShowonlyProtocol->currentItem() == nullptr)
return;
bool ok;
......@@ -355,7 +355,7 @@ void ActionProperty::editProtocol()
void ActionProperty::removeProtocol()
{
if (lbShowonlyProtocol->currentItem() != 0) {
if (lbShowonlyProtocol->currentItem() != nullptr) {
delete lbShowonlyProtocol->currentItem();
setModified();
}
......@@ -372,7 +372,7 @@ void ActionProperty::addPath()
void ActionProperty::editPath()
{
if (lbShowonlyPath->currentItem() == 0)
if (lbShowonlyPath->currentItem() == nullptr)
return;
bool ok;
......@@ -389,7 +389,7 @@ void ActionProperty::editPath()
void ActionProperty::removePath()
{
if (lbShowonlyPath->currentItem() != 0) {
if (lbShowonlyPath->currentItem() != nullptr) {
delete lbShowonlyPath->currentItem();
setModified();
}
......@@ -413,7 +413,7 @@ void ActionProperty::addMime()
void ActionProperty::editMime()
{
if (lbShowonlyMime->currentItem() == 0)
if (lbShowonlyMime->currentItem() == nullptr)
return;
bool ok;
......@@ -430,7 +430,7 @@ void ActionProperty::editMime()
void ActionProperty::removeMime()
{
if (lbShowonlyMime->currentItem() != 0) {
if (lbShowonlyMime->currentItem() != nullptr) {
delete lbShowonlyMime->currentItem();
setModified();
}
......@@ -454,7 +454,7 @@ void ActionProperty::newFile()
void ActionProperty::editFile()
{
if (lbShowonlyFile->currentItem() == 0)
if (lbShowonlyFile->currentItem() == nullptr)
return;
bool ok;
......@@ -471,7 +471,7 @@ void ActionProperty::editFile()
void ActionProperty::removeFile()
{
if (lbShowonlyFile->currentItem() != 0) {
if (lbShowonlyFile->currentItem() != nullptr) {
delete lbShowonlyFile->currentItem();
setModified();
}
......
......@@ -32,7 +32,7 @@ class ActionProperty : public QWidget, public Ui::ActionProperty
{
Q_OBJECT
public:
explicit ActionProperty(QWidget *parent = 0, KrAction *action = 0);
explicit ActionProperty(QWidget *parent = nullptr, KrAction *action = nullptr);
~ActionProperty();
/**
......@@ -48,7 +48,7 @@ public:
* It also resets the changed() state.
* @param action the action which should be displayd
*/
void updateGUI(KrAction *action = 0);
void updateGUI(KrAction *action = nullptr);
/**
* This writes the displayed properties back into the action.
......@@ -56,7 +56,7 @@ public:
* It also resets the changed() state.
* @param action the action which should be manipulated
*/
void updateAction(KrAction *action = 0);
void updateAction(KrAction *action = nullptr);
/**
* clears everything
......
......@@ -108,7 +108,7 @@ AddPlaceholderPopup::AddPlaceholderPopup(QWidget *parent) : QMenu(parent)
QString AddPlaceholderPopup::getPlaceholder(const QPoint& pos)
{
QAction *res = exec(pos);
if (res == 0)
if (res == nullptr)
return QString();
// add the selected flag to the command line
......
......@@ -90,7 +90,7 @@ void UserActionListView::update(KrAction* action)
UserActionListViewItem* UserActionListView::insertAction(KrAction* action)
{
if (! action)
return 0;
return nullptr;
UserActionListViewItem* item;
......@@ -118,7 +118,7 @@ QTreeWidgetItem* UserActionListView::findCategoryItem(const QString& category)
return *it;
it++;
}
return 0;
return nullptr;
}
UserActionListViewItem* UserActionListView::findActionItem(const KrAction* action)
......@@ -131,7 +131,7 @@ UserActionListViewItem* UserActionListView::findActionItem(const KrAction* actio
}
it++;
}
return 0;
return nullptr;
}
KrAction * UserActionListView::currentAction() const
......@@ -139,7 +139,7 @@ KrAction * UserActionListView::currentAction() const
if (UserActionListViewItem* item = dynamic_cast<UserActionListViewItem*>(currentItem()))
return item->action();
else
return 0;
return nullptr;
}
void UserActionListView::setCurrentAction(const KrAction* action)
......
......@@ -33,7 +33,7 @@ class UserActionListView : public KrTreeWidget
Q_OBJECT
public:
explicit UserActionListView(QWidget* parent = 0);
explicit UserActionListView(QWidget* parent = nullptr);
~UserActionListView();
virtual QSize sizeHint() const Q_DECL_OVERRIDE;
......@@ -44,7 +44,7 @@ public:
KrAction* currentAction() const;
void setCurrentAction(const KrAction*);
QDomDocument dumpSelectedActions(QDomDocument* mergeDoc = 0) const;
QDomDocument dumpSelectedActions(QDomDocument* mergeDoc = nullptr) const;
void removeSelectedActions();
......
......@@ -42,7 +42,7 @@
extern KRarcHandler arcHandler;
AbstractThreadedJob::AbstractThreadedJob() : KIO::Job(), _locker(), _waiter(), _stack(), _maxProgressValue(0),
_currentProgress(0), _exiting(false), _jobThread(0)
_currentProgress(0), _exiting(false), _jobThread(nullptr)
{
}
......@@ -175,7 +175,7 @@ bool AbstractThreadedJob::event(QEvent *e)
case CMD_MESSAGE: {
QString message = event->args()[ 0 ].value<QString>();
KIO::JobUiDelegate *ui = static_cast<KIO::JobUiDelegate*>(uiDelegate());
KMessageBox::information(ui ? ui->window() : 0, message);
KMessageBox::information(ui ? ui->window() : nullptr, message);
QList<QVariant> *resultResp = new QList<QVariant> ();
addEventResponse(resultResp);
}
......@@ -201,7 +201,7 @@ QList<QVariant> * AbstractThreadedJob::getEventResponse(UserEvent * event)
QApplication::postEvent(this, event);
_waiter.wait(&_locker);
if (_exiting)
return 0;
return nullptr;
QList<QVariant> *resp = _stack.pop();
_locker.unlock();
return resp;
......@@ -289,8 +289,8 @@ public:
};
AbstractJobThread::AbstractJobThread() : _job(0), _downloadTempDir(0), _observer(0), _tempFile(0),
_tempDir(0), _exited(false)
AbstractJobThread::AbstractJobThread() : _job(nullptr), _downloadTempDir(nullptr), _observer(nullptr), _tempFile(nullptr),
_tempDir(nullptr), _exited(false)
{
}
......@@ -298,15 +298,15 @@ AbstractJobThread::~AbstractJobThread()
{
if (_downloadTempDir) {
delete _downloadTempDir;
_downloadTempDir = 0;
_downloadTempDir = nullptr;
}
if (_observer) {
delete _observer;
_observer = 0;
_observer = nullptr;
}
if (_tempFile) {
delete _tempFile;
_tempFile = 0;
_tempFile = nullptr;
}
}
......@@ -318,7 +318,7 @@ void AbstractJobThread::run()
_loop = threadLoop;
threadLoop->exec();
_loop = 0;
_loop = nullptr;
delete threadLoop;
}
......@@ -365,7 +365,7 @@ QUrl AbstractJobThread::downloadIfRemote(const QUrl &baseUrl, const QStringList
UserEvent * downloadEvent = new UserEvent(CMD_DOWNLOAD_FILES, args);
QList<QVariant> * result = _job->getEventResponse(downloadEvent);
if (result == 0)
if (result == nullptr)
return QUrl();
int errorCode = (*result)[ 0 ].value<int>();
......@@ -531,7 +531,7 @@ KRarcObserver * AbstractJobThread::observer()
bool AbstractJobThread::uploadTempFiles()
{
if (_tempFile != 0 || _tempDir != 0) {
if (_tempFile != nullptr || _tempDir != nullptr) {
sendInfo(i18n("Uploading to remote destination"));
if (_tempFile) {
......@@ -544,7 +544,7 @@ bool AbstractJobThread::uploadTempFiles()
UserEvent * uploadEvent = new UserEvent(CMD_UPLOAD_FILES, args);
QList<QVariant> * result = _job->getEventResponse(uploadEvent);
if (result == 0)
if (result == nullptr)
return false;
int errorCode = (*result)[ 0 ].value<int>();
......@@ -576,7 +576,7 @@ bool AbstractJobThread::uploadTempFiles()
UserEvent * uploadEvent = new UserEvent(CMD_UPLOAD_FILES, args);
QList<QVariant> * result = _job->getEventResponse(uploadEvent);
if (result == 0)
if (result == nullptr)
return false;
int errorCode = (*result)[ 0 ].value<int>();
......@@ -600,7 +600,7 @@ QString AbstractJobThread::getPassword(const QString &path)
UserEvent * getPasswdEvent = new UserEvent(CMD_GET_PASSWORD, args);
QList<QVariant> * result = _job->getEventResponse(getPasswdEvent);
if (result == 0)
if (result == nullptr)
return QString();
QString password = (*result)[ 0 ].value<QString>();
......@@ -618,7 +618,7 @@ void AbstractJobThread::sendMessage(const QString &message)
UserEvent * getPasswdEvent = new UserEvent(CMD_MESSAGE, args);
QList<QVariant> * result = _job->getEventResponse(getPasswdEvent);
if (result == 0)
if (result == nullptr)
return;
delete result;
}
......
......@@ -83,7 +83,7 @@ public:
static QStringList arcProtocols = QString("tar;bzip;bzip2;lzma;xz;gzip;krarc;zip").split(';');
KWallet::Wallet * KRarcHandler::wallet = 0;
KWallet::Wallet * KRarcHandler::wallet = nullptr;
QStringList KRarcHandler::supportedPackers()
{
......@@ -573,7 +573,7 @@ bool KRarcHandler::openWallet()
wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), actWindow->effectiveWinId());
}
return (wallet != 0);
return (wallet != nullptr);
}
QString KRarcHandler::getPassword(QString path)
......@@ -583,9 +583,9 @@ QString KRarcHandler::getPassword(QString path)
QString key = "krarc-" + path;
if (!KWallet::Wallet::keyDoesNotExist(KWallet::Wallet::NetworkWallet(), KWallet::Wallet::PasswordFolder(), key)) {
if (!KWallet::Wallet::isOpen(KWallet::Wallet::NetworkWallet()) && wallet != 0) {
if (!KWallet::Wallet::isOpen(KWallet::Wallet::NetworkWallet()) && wallet != nullptr) {
delete wallet;
wallet = 0;
wallet = nullptr;
}
if (openWallet() && wallet->hasFolder(KWallet::Wallet::PasswordFolder())) {
wallet->setFolder(KWallet::Wallet::PasswordFolder());
......@@ -600,16 +600,16 @@ QString KRarcHandler::getPassword(QString path)
bool keep = true;
QString user = "archive";
QPointer<KPasswordDialog> passDlg = new KPasswordDialog(0L, KPasswordDialog::ShowKeepPassword);
QPointer<KPasswordDialog> passDlg = new KPasswordDialog(nullptr, KPasswordDialog::ShowKeepPassword);
passDlg->setPrompt(i18n("This archive is encrypted, please supply the password:") ),
passDlg->setUsername(user);
passDlg->setPassword(password);
if (passDlg->exec() == KPasswordDialog::Accepted) {
password = passDlg->password();
if (keep) {
if (!KWallet::Wallet::isOpen(KWallet::Wallet::NetworkWallet()) && wallet != 0) {
if (!KWallet::Wallet::isOpen(KWallet::Wallet::NetworkWallet()) && wallet != nullptr) {
delete wallet;
wallet = 0;
wallet = nullptr;
}
if (openWallet()) {
bool ok = true;
......
......@@ -179,7 +179,7 @@ KrBookmark * KrAddBookmarkDlg::folder() const
{
QList<QTreeWidgetItem *> items = _createIn->selectedItems();
if (items.count() == 0)
return 0;
return nullptr;
return _xr[ items[ 0 ] ];
}
......
......@@ -47,7 +47,7 @@ KrBookmark::KrBookmark(QString name, QUrl url, KActionCollection *parent, QStrin
}
KrBookmark::KrBookmark(QString name, QString iconName) :
QAction(Icon(iconName), name, 0), _iconName(iconName), _folder(true), _separator(false), _autoDelete(false)
QAction(Icon(iconName), name, nullptr), _iconName(iconName), _folder(true), _separator(false), _autoDelete(false)
{
setIcon(Icon(iconName == "" ? "folder" : iconName));
}
......
......@@ -71,7 +71,7 @@ public:
static KrBookmark * trash(KActionCollection *collection);
static KrBookmark * virt(KActionCollection *collection);
static KrBookmark * lan(KActionCollection *collection);
static QAction * jumpBackAction(KActionCollection *collection, bool isSetter = false, ListPanelActions *sourceActions = 0);
static QAction * jumpBackAction(KActionCollection *collection, bool isSetter = false, ListPanelActions *sourceActions = nullptr);
static KrBookmark * separator();
signals:
......
......@@ -59,7 +59,7 @@ KrBookmarkHandler::KrBookmarkHandler(KrMainWindow *mainWindow) :
QObject(mainWindow->widget()),
_mainWindow(mainWindow),
_middleClick(false),
_mainBookmarkPopup(0),
_mainBookmarkPopup(nullptr),
_specialBookmarks(),
_quickSearchAction(nullptr),
_quickSearchBar(nullptr),
......@@ -113,7 +113,7 @@ void KrBookmarkHandler::bookmarkCurrent(QUrl url)
void KrBookmarkHandler::addBookmark(KrBookmark *bm, KrBookmark *folder)
{
if (folder == 0)
if (folder == nullptr)
folder = _root;
// add to the list (bottom)
......@@ -519,7 +519,7 @@ void KrBookmarkHandler::buildMenu(KrBookmark *parent, QMenu *menu, int depth)
_specialBookmarks.append(bmAct);
// make sure the menu is connected to us
disconnect(menu, SIGNAL(triggered(QAction*)), 0, 0);
disconnect(menu, SIGNAL(triggered(QAction*)), nullptr, nullptr);
}
menu->installEventFilter(this);
......@@ -709,7 +709,7 @@ bool KrBookmarkHandler::eventFilter(QObject *obj, QEvent *ev)
}
KrBookmark *bm = qobject_cast<KrBookmark *>(act);
if (bm != 0) {
if (bm != nullptr) {
rightClicked(menu, bm);
return true;
} else if (act && act->data().canConvert<KrBookmark *>()) {
......
......@@ -50,7 +50,7 @@ public:
explicit KrBookmarkHandler(KrMainWindow *mainWindow);
~KrBookmarkHandler();
void populate(QMenu *menu);
void addBookmark(KrBookmark *bm, KrBookmark *parent = 0);
void addBookmark(KrBookmark *bm, KrBookmark *parent = nullptr);
void bookmarkCurrent(QUrl url);
protected:
......
......@@ -116,21 +116,21 @@ ChecksumProcess::ChecksumProcess(QObject *parent, const QString &path) : KProces
ChecksumProcess::~ChecksumProcess()
{
disconnect(this, 0, this, 0); // QProcess emits finished() on destruction
disconnect(this, nullptr, this, nullptr); // QProcess emits finished() on destruction