Clang: reduce 0-as-nullptr warnings

This commit is contained in:
Adriaan de Groot 2017-09-20 09:16:15 -04:00
parent 337903db09
commit 34761c4214
3 changed files with 7 additions and 7 deletions

View File

@ -104,7 +104,7 @@ QObject* PluginFactory::create( const char* iface, QWidget* parentWidget, QObjec
{ {
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

@ -223,7 +223,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
@ -236,7 +236,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 );
@ -322,7 +322,7 @@ 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 );
@ -339,7 +339,7 @@ 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() );
@ -353,7 +353,7 @@ 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 );

View File

@ -357,7 +357,7 @@ RequirementsChecker::checkHasPower()
QDBusInterface upowerIntf( UPOWER_SVC_NAME, QDBusInterface upowerIntf( UPOWER_SVC_NAME,
UPOWER_PATH, UPOWER_PATH,
UPOWER_INTF_NAME, UPOWER_INTF_NAME,
QDBusConnection::systemBus(), 0 ); QDBusConnection::systemBus() );
bool onBattery = upowerIntf.property( "OnBattery" ).toBool(); bool onBattery = upowerIntf.property( "OnBattery" ).toBool();