Skip to content

Commit

Permalink
GCS: Use nullptr for null pointers (#2024)
Browse files Browse the repository at this point in the history
  • Loading branch information
tracernz authored and mlyle committed Jan 9, 2018
1 parent be3307d commit a99b608
Show file tree
Hide file tree
Showing 313 changed files with 567 additions and 567 deletions.
2 changes: 1 addition & 1 deletion ground/gcs/src/app/customsplash.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CustomSplash : public QSplashScreen
{
Q_OBJECT
public:
explicit CustomSplash(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0);
explicit CustomSplash(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = nullptr);
int m_progress;
QPixmap m_pixmap;
QColor m_progress_bar_color;
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ int main(int argc, char **argv)
return 1;
}
const PluginSpecSet plugins = pluginManager.plugins();
ExtensionSystem::PluginSpec *coreplugin = 0;
ExtensionSystem::PluginSpec *coreplugin = nullptr;
foreach (ExtensionSystem::PluginSpec *spec, plugins) {
if (spec->name() == QLatin1String(corePluginNameC)) {
coreplugin = spec;
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/crashreporterapp/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MainWindow : public QMainWindow
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
void setDumpFile(QString filename);

Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/extensionsystem/iplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ IPlugin::~IPlugin()
qDeleteAll(d->addedObjectsInReverseOrder);
d->addedObjectsInReverseOrder.clear();
delete d;
d = 0;
d = nullptr;
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/extensionsystem/plugindetailsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class EXTENSIONSYSTEM_EXPORT PluginDetailsView : public QWidget
Q_OBJECT

public:
PluginDetailsView(QWidget *parent = 0);
PluginDetailsView(QWidget *parent = nullptr);
~PluginDetailsView();

void update(PluginSpec *spec);
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/extensionsystem/pluginerrorview.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class EXTENSIONSYSTEM_EXPORT PluginErrorView : public QWidget
Q_OBJECT

public:
PluginErrorView(QWidget *parent = 0);
PluginErrorView(QWidget *parent = nullptr);
~PluginErrorView();

void update(PluginSpec *spec);
Expand Down
12 changes: 6 additions & 6 deletions ground/gcs/src/libs/extensionsystem/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static bool lessThanByPluginName(const PluginSpec *one, const PluginSpec *two)
return one->name() < two->name();
}

PluginManager *PluginManager::m_instance = 0;
PluginManager *PluginManager::m_instance = nullptr;

/*!
\fn PluginManager *PluginManager::instance()
Expand Down Expand Up @@ -192,7 +192,7 @@ PluginManager::PluginManager()
PluginManager::~PluginManager()
{
delete d;
d = 0;
d = nullptr;
}

/*!
Expand Down Expand Up @@ -506,7 +506,7 @@ void PluginManagerPrivate::addObject(QObject *obj)
{
{
QWriteLocker lock(&(q->m_lock));
if (obj == 0) {
if (obj == nullptr) {
qWarning() << "PluginManagerPrivate::addObject(): trying to add null object";
return;
}
Expand All @@ -529,7 +529,7 @@ void PluginManagerPrivate::addObject(QObject *obj)
*/
void PluginManagerPrivate::removeObject(QObject *obj)
{
if (obj == 0) {
if (obj == nullptr) {
qWarning() << "PluginManagerPrivate::removeObject(): trying to remove null object";
return;
}
Expand Down Expand Up @@ -737,13 +737,13 @@ PluginSpec *PluginManagerPrivate::pluginForOption(const QString &option, bool *r
}
}
}
return 0;
return nullptr;
}

PluginSpec *PluginManagerPrivate::pluginByName(const QString &name) const
{
foreach (PluginSpec *spec, pluginSpecs)
if (spec->name() == name)
return spec;
return 0;
return nullptr;
}
4 changes: 2 additions & 2 deletions ground/gcs/src/libs/extensionsystem/pluginmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class EXTENSIONSYSTEM_EXPORT PluginManager : public QObject
{
QReadLocker lock(&m_lock);
QList<QObject *> all = allObjects();
T *result = 0;
T *result = nullptr;
foreach (QObject *obj, all) {
if ((result = Aggregation::query<T>(obj)) != 0)
if ((result = Aggregation::query<T>(obj)) != nullptr)
break;
}
return result;
Expand Down
8 changes: 4 additions & 4 deletions ground/gcs/src/libs/extensionsystem/pluginspec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ PluginSpec::PluginSpec()
PluginSpec::~PluginSpec()
{
delete d;
d = 0;
d = nullptr;
}

/*!
Expand Down Expand Up @@ -381,7 +381,7 @@ namespace {
\internal
*/
PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec)
: plugin(0),
: plugin(nullptr),
state(PluginSpec::Invalid),
hasError(false),
q(spec)
Expand Down Expand Up @@ -721,7 +721,7 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
}
QList<PluginSpec *> resolvedDependencies;
foreach (const PluginDependency &dependency, dependencies) {
PluginSpec *found = 0;
PluginSpec *found = nullptr;
foreach (PluginSpec *spec, specs) {
if (spec->provides(dependency.name, dependency.version)) {
found = spec;
Expand Down Expand Up @@ -877,7 +877,7 @@ void PluginSpecPrivate::kill()
if (!plugin)
return;
delete plugin;
plugin = 0;
plugin = nullptr;
state = PluginSpec::Deleted;
}

6 changes: 3 additions & 3 deletions ground/gcs/src/libs/extensionsystem/pluginview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ PluginView::~PluginView()
PluginSpec *PluginView::currentPlugin() const
{
if (!m_ui->pluginWidget->currentItem())
return 0;
return nullptr;
return m_ui->pluginWidget->currentItem()->data(0, Qt::UserRole).value<PluginSpec *>();
}

Expand All @@ -115,7 +115,7 @@ void PluginView::updateList()
static QIcon okIcon(":/extensionsystem/images/ok.png");
static QIcon errorIcon(":/extensionsystem/images/error.png");
QList<QTreeWidgetItem *> items;
QTreeWidgetItem *currentItem = 0;
QTreeWidgetItem *currentItem = nullptr;
PluginSpec *currPlugin = currentPlugin();
foreach (PluginSpec *spec, p->manager->plugins()) {
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList()
Expand Down Expand Up @@ -143,7 +143,7 @@ void PluginView::updateList()
void PluginView::selectPlugin(QTreeWidgetItem *current)
{
if (!current)
emit currentPluginChanged(0);
emit currentPluginChanged(nullptr);
else
emit currentPluginChanged(current->data(0, Qt::UserRole).value<PluginSpec *>());
}
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/extensionsystem/pluginview.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class EXTENSIONSYSTEM_EXPORT PluginView : public QWidget
Q_OBJECT

public:
PluginView(PluginManager *manager, QWidget *parent = 0);
PluginView(PluginManager *manager, QWidget *parent = nullptr);
~PluginView();

PluginSpec *currentPlugin() const;
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/tlmapcontrol/core/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <QSettings>

namespace core {
Cache* Cache::m_pInstance=0;
Cache* Cache::m_pInstance=nullptr;

Cache* Cache::Instance()
{
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/tlmapcontrol/core/tlmaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
using namespace projections;

namespace core {
TLMaps* TLMaps::m_pInstance=0;
TLMaps* TLMaps::m_pInstance=nullptr;

TLMaps* TLMaps::Instance()
{
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/tlmapcontrol/core/urlfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void UrlFactory::TryCorrectGoogleVersions()
QMutexLocker locker(&mutex);
if(CorrectGoogleVersions && !IsCorrectGoogleVersions())
{
QNetworkReply *reply = 0;
QNetworkReply *reply = nullptr;
QNetworkRequest qheader;
QNetworkAccessManager network;
QEventLoop q;
Expand Down
8 changes: 4 additions & 4 deletions ground/gcs/src/libs/tlmapcontrol/internals/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace internals {
{
Tile* m = Matrix.TileAt(task.Pos);

if(m==0 || m->Overlays.count() == 0)
if(m==nullptr || m->Overlays.count() == 0)
{
#ifdef DEBUG_CORE
qDebug()<<"Fill empty TileMatrix: " + task.ToString()<<" ID="<<debug;;
Expand Down Expand Up @@ -178,7 +178,7 @@ namespace internals {
// emit OnTilesStillToLoad(tilesToload);

delete t;
t = 0;
t = nullptr;
emit OnNeedInvalidation();
}

Expand Down Expand Up @@ -381,8 +381,8 @@ namespace internals {
}
unsigned int bitsWithZoom = numBits + (quint8)maxzoom;
//Ensure that no matter what the zoom can never exceed the number of bits required to display it
if (bitsWithZoom > sizeof(((core::Point *) 0)->X())*8 - 1){ //Remove one because of the sign bit.
maxzoom = sizeof(((core::Point *) 0)->X())*8 - 1 - numBits;
if (bitsWithZoom > sizeof(((core::Point *) nullptr)->X())*8 - 1){ //Remove one because of the sign bit.
maxzoom = sizeof(((core::Point *) nullptr)->X())*8 - 1 - numBits;
}

minOfTiles = Projection()->GetTileMatrixMinXY(Zoom());
Expand Down
8 changes: 4 additions & 4 deletions ground/gcs/src/libs/tlmapcontrol/internals/tilematrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void TileMatrix::Clear()
foreach(Tile* t,matrix.values())
{
delete t;
t=0;
t=nullptr;
}
matrix.clear();
mutex.unlock();
Expand Down Expand Up @@ -112,11 +112,11 @@ void TileMatrix::ClearPointsNotIn(QList<Point>list)
foreach(Point p,removals)
{
Tile* t=TileAt(p);
if(t!=0)
if(t!=nullptr)
{
mutex.lock();
delete t;
t=0;
t=nullptr;
matrix.remove(p);
mutex.unlock();
}
Expand All @@ -140,7 +140,7 @@ void TileMatrix::SetTileAt(const Point &p, Tile* tile)
{
mutex.lock();
Tile* t=matrix.value(p,0);
if(t!=0)
if(t!=nullptr)
delete t;
matrix.insert(p,tile);
mutex.unlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ namespace mapcontrol

// render tile
//lock(t.Overlays)
if(t!=0)
if(t!=nullptr)
{
foreach(QByteArray img,t->Overlays)
{
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/tlmapcontrol/mapwidget/mapripform.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MapRipForm : public QWidget
Q_OBJECT

public:
explicit MapRipForm(QWidget *parent = 0);
explicit MapRipForm(QWidget *parent = nullptr);
~MapRipForm();
public slots:
void SetPercentage(int const& perc);
Expand Down
2 changes: 1 addition & 1 deletion ground/gcs/src/libs/tlmapcontrol/mapwidget/mapripper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace mapcontrol
{

MapRipper::MapRipper(internals::Core * core, const internals::RectLatLng & rect):sleep(100),cancel(false),progressForm(0),core(core),yesToAll(false)
MapRipper::MapRipper(internals::Core * core, const internals::RectLatLng & rect):sleep(100),cancel(false),progressForm(nullptr),core(core),yesToAll(false)
{
if(!rect.IsEmpty())
{
Expand Down
Loading

0 comments on commit a99b608

Please sign in to comment.