Clang: reduce warnings

This commit is contained in:
Adriaan de Groot 2017-09-13 08:03:18 -04:00
parent ec86922839
commit be2338ff08
6 changed files with 48 additions and 48 deletions

View File

@ -32,7 +32,7 @@ public:
bool runInChroot = false, bool runInChroot = false,
int secondsTimeout = 30, int secondsTimeout = 30,
QObject* parent = nullptr ); QObject* parent = nullptr );
virtual ~ProcessJob(); virtual ~ProcessJob() override;
QString prettyName() const override; QString prettyName() const override;
QString prettyStatusMessage() const override; QString prettyStatusMessage() const override;

View File

@ -34,7 +34,7 @@ namespace Calamares
{ {
PluginFactory::PluginFactory() PluginFactory::PluginFactory()
: d_ptr(new PluginFactoryPrivate) : d_ptr_p(new PluginFactoryPrivate)
{ {
Q_D(PluginFactory); Q_D(PluginFactory);
d->q_ptr = this; d->q_ptr = this;
@ -43,14 +43,14 @@ PluginFactory::PluginFactory()
} }
PluginFactory::PluginFactory(PluginFactoryPrivate &d) PluginFactory::PluginFactory(PluginFactoryPrivate &d)
: d_ptr(&d) : d_ptr_p(&d)
{ {
factorycleanup()->add(this); factorycleanup()->add(this);
} }
PluginFactory::~PluginFactory() PluginFactory::~PluginFactory()
{ {
delete d_ptr; delete d_ptr_p;
} }
void PluginFactory::doRegisterPlugin(const QString &keyword, const QMetaObject *metaObject, CreateInstanceFunction instanceFunction) void PluginFactory::doRegisterPlugin(const QString &keyword, const QMetaObject *metaObject, CreateInstanceFunction instanceFunction)
@ -97,7 +97,7 @@ QObject *PluginFactory::create(const char *iface, QWidget *parentWidget, QObject
{ {
Q_D(PluginFactory); Q_D(PluginFactory);
QObject *obj = 0; QObject *obj( nullptr );
const QList<PluginFactoryPrivate::Plugin> candidates(d->createInstanceHash.values(keyword)); const QList<PluginFactoryPrivate::Plugin> candidates(d->createInstanceHash.values(keyword));
// for !keyword.isEmpty() candidates.count() is 0 or 1 // for !keyword.isEmpty() candidates.count() is 0 or 1

View File

@ -222,7 +222,7 @@ public:
* \returns A pointer to the created object is returned, or 0 if an error occurred. * \returns A pointer to the created object is returned, or 0 if an error occurred.
*/ */
template<typename T> template<typename T>
T *create(QObject *parent = 0); T* create( QObject* parent = nullptr );
/** /**
* Use this method to create an object. It will try to create an object which inherits * Use this method to create an object. It will try to create an object which inherits
@ -235,7 +235,7 @@ public:
* \returns A pointer to the created object is returned, or 0 if an error occurred. * \returns A pointer to the created object is returned, or 0 if an error occurred.
*/ */
template<typename T> template<typename T>
T *create(const QString &keyword, QObject *parent = 0); T* create( const QString& keyword, QObject* parent = nullptr );
Q_SIGNALS: Q_SIGNALS:
void objectCreated( QObject* object ); void objectCreated( QObject* object );
@ -251,7 +251,8 @@ protected:
* You can inherit it, if you want to add new classes and still keep support for the old ones. * You can inherit it, if you want to add new classes and still keep support for the old ones.
*/ */
template<class impl> template<class impl>
struct InheritanceChecker { struct InheritanceChecker
{
CreateInstanceFunction createInstanceFunction( QWidget* ) CreateInstanceFunction createInstanceFunction( QWidget* )
{ {
return &createInstance<impl, QWidget>; return &createInstance<impl, QWidget>;
@ -299,7 +300,7 @@ protected:
doRegisterPlugin( keyword, &T::staticMetaObject, instanceFunction ); doRegisterPlugin( keyword, &T::staticMetaObject, instanceFunction );
} }
PluginFactoryPrivate *const d_ptr; PluginFactoryPrivate* const d_ptr_p;
/** /**
* This function is called when the factory asked to create an Object. * This function is called when the factory asked to create an Object.
@ -320,8 +321,9 @@ protected:
static QObject* createInstance( QWidget* parentWidget, QObject* parent ) static QObject* createInstance( QWidget* parentWidget, QObject* parent )
{ {
Q_UNUSED( parentWidget ); Q_UNUSED( parentWidget );
ParentType *p = 0; ParentType* p( nullptr );
if (parent) { if ( parent )
{
p = qobject_cast<ParentType*>( parent ); p = qobject_cast<ParentType*>( parent );
Q_ASSERT( p ); Q_ASSERT( p );
} }
@ -336,14 +338,13 @@ template<typename T>
inline T* PluginFactory::create( QObject* parent ) inline T* PluginFactory::create( QObject* parent )
{ {
QObject* o = create( T::staticMetaObject.className(), QObject* o = create( T::staticMetaObject.className(),
parent && parent->isWidgetType() ? reinterpret_cast<QWidget *>(parent) : 0, parent && parent->isWidgetType() ? reinterpret_cast<QWidget*>( parent ) : nullptr,
parent, parent,
QString() ); QString() );
T* t = qobject_cast<T*>( o ); T* t = qobject_cast<T*>( o );
if (!t) { if ( !t )
delete o; delete o;
}
return t; return t;
} }
@ -351,14 +352,13 @@ template<typename T>
inline T* PluginFactory::create( const QString& keyword, QObject* parent ) inline T* PluginFactory::create( const QString& keyword, QObject* parent )
{ {
QObject* o = create( T::staticMetaObject.className(), QObject* o = create( T::staticMetaObject.className(),
parent && parent->isWidgetType() ? reinterpret_cast<QWidget *>(parent) : 0, parent && parent->isWidgetType() ? reinterpret_cast<QWidget*>( parent ) : nullptr,
parent, parent,
keyword ); keyword );
T* t = qobject_cast<T*>( o ); T* t = qobject_cast<T*>( o );
if (!t) { if ( !t )
delete o; delete o;
}
return t; return t;
} }

View File

@ -42,7 +42,7 @@ protected:
private: private:
friend class Module; //so only the superclass can instantiate friend class Module; //so only the superclass can instantiate
explicit CppJobModule(); explicit CppJobModule();
virtual ~CppJobModule(); virtual ~CppJobModule() override;
QPluginLoader* m_loader; QPluginLoader* m_loader;
job_ptr m_job; job_ptr m_job;

View File

@ -40,7 +40,7 @@ protected:
private: private:
friend class Module; friend class Module;
explicit ProcessJobModule(); explicit ProcessJobModule();
virtual ~ProcessJobModule(); virtual ~ProcessJobModule() override;
QString m_command; QString m_command;
QString m_workingPath; QString m_workingPath;

View File

@ -43,7 +43,7 @@ protected:
private: private:
friend class Module; //so only the superclass can instantiate friend class Module; //so only the superclass can instantiate
explicit ViewModule(); explicit ViewModule();
virtual ~ViewModule(); virtual ~ViewModule() override;
QPluginLoader* m_loader; QPluginLoader* m_loader;
ViewStep* m_viewStep = nullptr; ViewStep* m_viewStep = nullptr;