Replace the zeroing of pointers with nullptr

This commit is contained in:
thalieht
2018-04-15 13:06:31 +03:00
committed by sledgehammer999
parent 667f84995c
commit 9cb190ebe7
47 changed files with 98 additions and 98 deletions

View File

@@ -1005,7 +1005,7 @@ void Session::freeInstance()
{
if (m_instance) {
delete m_instance;
m_instance = 0;
m_instance = nullptr;
}
}

View File

@@ -562,7 +562,7 @@ namespace BitTorrent
bool requestedFileDeletion;
};
explicit Session(QObject *parent = 0);
explicit Session(QObject *parent = nullptr);
~Session();
bool hasPerTorrentRatioLimit() const;

View File

@@ -1639,7 +1639,7 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(libtorrent::save_resume_data
// if torrent has no metadata we should save dummy fastresume data
// containing Magnet URI and qBittorrent own resume data only
if (p->error.value() == libt::errors::no_metadata)
handleSaveResumeDataAlert(0);
handleSaveResumeDataAlert(nullptr);
else
m_session->handleTorrentResumeDataFailed(this);
}

View File

@@ -50,7 +50,7 @@ namespace Http
Q_DISABLE_COPY(Connection)
public:
Connection(QTcpSocket *socket, IRequestHandler *requestHandler, QObject *parent = 0);
Connection(QTcpSocket *socket, IRequestHandler *requestHandler, QObject *parent = nullptr);
~Connection();
bool hasExpired(qint64 timeout) const;

View File

@@ -47,7 +47,7 @@ void IconProvider::freeInstance()
{
if (m_instance) {
delete m_instance;
m_instance = 0;
m_instance = nullptr;
}
}
@@ -61,4 +61,4 @@ QString IconProvider::getIconPath(const QString &iconId)
return ":/icons/qbt-theme/" + iconId + ".png";
}
IconProvider *IconProvider::m_instance = 0;
IconProvider *IconProvider::m_instance = nullptr;

View File

@@ -46,7 +46,7 @@ public:
virtual QString getIconPath(const QString &iconId);
protected:
explicit IconProvider(QObject *parent = 0);
explicit IconProvider(QObject *parent = nullptr);
~IconProvider();
static IconProvider *m_instance;

View File

@@ -3,7 +3,7 @@
#include <QDateTime>
#include "base/utils/string.h"
Logger* Logger::m_instance = 0;
Logger* Logger::m_instance = nullptr;
Logger::Logger()
: lock(QReadWriteLock::Recursive)
@@ -29,7 +29,7 @@ void Logger::freeInstance()
{
if (m_instance) {
delete m_instance;
m_instance = 0;
m_instance = nullptr;
}
}

View File

@@ -51,7 +51,7 @@ namespace
class NetworkCookieJar: public QNetworkCookieJar
{
public:
explicit NetworkCookieJar(QObject *parent = 0)
explicit NetworkCookieJar(QObject *parent = nullptr)
: QNetworkCookieJar(parent)
{
QDateTime now = QDateTime::currentDateTime();
@@ -107,7 +107,7 @@ namespace
using namespace Net;
DownloadManager *DownloadManager::m_instance = 0;
DownloadManager *DownloadManager::m_instance = nullptr;
DownloadManager::DownloadManager(QObject *parent)
: QObject(parent)
@@ -128,7 +128,7 @@ void DownloadManager::freeInstance()
{
if (m_instance) {
delete m_instance;
m_instance = 0;
m_instance = nullptr;
}
}

View File

@@ -64,7 +64,7 @@ namespace Net
#endif
private:
explicit DownloadManager(QObject *parent = 0);
explicit DownloadManager(QObject *parent = nullptr);
void applyProxySettings();

View File

@@ -91,7 +91,7 @@ GeoIPDatabase::GeoIPDatabase(quint32 size)
GeoIPDatabase *GeoIPDatabase::load(const QString &filename, QString &error)
{
GeoIPDatabase *db = 0;
GeoIPDatabase *db = nullptr;
QFile file(filename);
if (file.size() > MAX_FILE_SIZE) {
error = tr("Unsupported database file size.");
@@ -122,7 +122,7 @@ GeoIPDatabase *GeoIPDatabase::load(const QString &filename, QString &error)
GeoIPDatabase *GeoIPDatabase::load(const QByteArray &data, QString &error)
{
GeoIPDatabase *db = 0;
GeoIPDatabase *db = nullptr;
if (data.size() > MAX_FILE_SIZE) {
error = tr("Unsupported database file size.");
return 0;

View File

@@ -80,7 +80,7 @@ void ProxyConfigurationManager::freeInstance()
{
if (m_instance) {
delete m_instance;
m_instance = 0;
m_instance = nullptr;
}
}

View File

@@ -47,7 +47,7 @@ namespace Net
Q_DISABLE_COPY(ReverseResolution)
public:
explicit ReverseResolution(QObject *parent = 0);
explicit ReverseResolution(QObject *parent = nullptr);
~ReverseResolution();
void resolve(const QString &ip);

View File

@@ -59,7 +59,7 @@
#include "utils/fs.h"
#include "utils/misc.h"
Preferences *Preferences::m_instance = 0;
Preferences *Preferences::m_instance = nullptr;
Preferences::Preferences() = default;
@@ -78,7 +78,7 @@ void Preferences::freeInstance()
{
if (m_instance) {
delete m_instance;
m_instance = 0;
m_instance = nullptr;
}
}

View File

@@ -56,7 +56,7 @@ struct ScanFoldersModel::PathData
QString downloadPath; // valid for CUSTOM_LOCATION
};
ScanFoldersModel *ScanFoldersModel::m_instance = 0;
ScanFoldersModel *ScanFoldersModel::m_instance = nullptr;
bool ScanFoldersModel::initInstance(QObject *parent)
{
@@ -72,7 +72,7 @@ void ScanFoldersModel::freeInstance()
{
if (m_instance) {
delete m_instance;
m_instance = 0;
m_instance = nullptr;
}
}
@@ -83,7 +83,7 @@ ScanFoldersModel *ScanFoldersModel::instance()
ScanFoldersModel::ScanFoldersModel(QObject *parent)
: QAbstractListModel(parent)
, m_fsWatcher(0)
, m_fsWatcher(nullptr)
{
configure();
connect(Preferences::instance(), SIGNAL(changed()), SLOT(configure()));

View File

@@ -66,7 +66,7 @@ public:
CUSTOM_LOCATION
};
static bool initInstance(QObject *parent = 0);
static bool initInstance(QObject *parent = nullptr);
static void freeInstance();
static ScanFoldersModel* instance();
@@ -97,7 +97,7 @@ private slots:
void addTorrentsToSession(const QStringList &pathList);
private:
explicit ScanFoldersModel(QObject *parent = 0);
explicit ScanFoldersModel(QObject *parent = nullptr);
~ScanFoldersModel();
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);

View File

@@ -52,7 +52,7 @@ namespace Utils
, const QString &pad = QLatin1String(" "));
bool isValidFileSystemName(const QString &name, bool allowSeparators = false);
qint64 freeDiskSpaceOnPath(const QString &path);
QString branchPath(const QString &filePath, QString *removed = 0);
QString branchPath(const QString &filePath, QString *removed = nullptr);
bool sameFileNames(const QString &first, const QString &second);
QString expandPath(const QString &path);
QString expandPathAbs(const QString &path);