diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 125be1d41bf4cbe254e69afa7edd4e18f466b01d..ed00a33377805b59d507ee4c86efe0f97ca4b9fb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -179,6 +179,7 @@ ELSE() ) ENDIF(${ENABLE_QT5} MATCHES true) +# ADD_DEFINITIONS("-w") IF(${ENABLE_QT5} MATCHES true) QT5_WRAP_CPP(LIB_HEADER_MOC ${qtsflphone_LIB_HDRS}) ELSE() @@ -186,6 +187,7 @@ ELSE() ENDIF(${ENABLE_QT5} MATCHES true) add_library( qtsflphone SHARED ${qtsflphone_LIB_SRCS} ${LIB_HEADER_MOC} ) +# REMOVE_DEFINITIONS("-w") IF(${ENABLE_QT5} MATCHES true) QT5_USE_MODULES(qtsflphone Core DBus) diff --git a/src/abstractcontactbackend.cpp b/src/abstractcontactbackend.cpp index c473b4f6ac254fba2d7294725bba99398eceef14..81aa0ea90950686b65e5cd8757aaafa4ab58840a 100644 --- a/src/abstractcontactbackend.cpp +++ b/src/abstractcontactbackend.cpp @@ -160,7 +160,7 @@ int AbstractContactBackend::rowCount( const QModelIndex& par ) const Qt::ItemFlags AbstractContactBackend::flags( const QModelIndex& idx ) const { if (!idx.isValid()) - return 0; + return Qt::NoItemFlags; return Qt::ItemIsEnabled | ((idx.parent().isValid())?Qt::ItemIsSelectable:Qt::ItemIsEnabled); } diff --git a/src/abstractcontactbackend.h b/src/abstractcontactbackend.h index 3955f0dbaa3c4f5257bd051350d6ab90f071b8e8..86c46769e4e762d9d9e4a5c2c7648ae963092483 100644 --- a/src/abstractcontactbackend.h +++ b/src/abstractcontactbackend.h @@ -38,7 +38,10 @@ typedef QList<Contact*> ContactList; ///AbstractContactBackend: Allow different way to handle contact without poluting the library class LIB_EXPORT AbstractContactBackend : public QAbstractItemModel { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: enum Role { Organization = 100, diff --git a/src/account.h b/src/account.h index ae8e190d678e45f9deb7e5b6ad24d039356ed10a..b5d07f84f9caf646eece0e94bca5fcd420538060 100644 --- a/src/account.h +++ b/src/account.h @@ -67,7 +67,10 @@ enum DtmfType { ///Account: a daemon account (SIP or AIX) class LIB_EXPORT Account : public QObject { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: ~Account(); diff --git a/src/accountlist.h b/src/accountlist.h index 3165782f18d42d2c3651c0184ebc5a9655856b82..c951d3782e831268c6d0d0a845c7990ead69810c 100644 --- a/src/accountlist.h +++ b/src/accountlist.h @@ -32,7 +32,10 @@ class AccountListColorVisitor; ///AccountList: List of all daemon accounts class LIB_EXPORT AccountList : public QAbstractListModel { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: friend class Account; diff --git a/src/audiocodecmodel.h b/src/audiocodecmodel.h index 8ce996b977234f87df4ac3150fa8b3bef297fc3f..c3a8b758fc0e16e844b31cb9cc6d687c98635600 100644 --- a/src/audiocodecmodel.h +++ b/src/audiocodecmodel.h @@ -24,7 +24,10 @@ ///AudioCodecModel: A model for account audio codec class LIB_EXPORT AudioCodecModel : public QAbstractListModel { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: //friend class Account; //Roles diff --git a/src/call.cpp b/src/call.cpp index 6acd58b35769fa13671abf5e8dd1554d4ffc6bc2..afab0b1bfeaa5f94ca37b3efe1273cdaf54e281e 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -168,7 +168,7 @@ Call::Call(Call::State startState, const QString& callId, QString peerName, QStr m_pContact(nullptr),m_pImModel(nullptr),m_LastContactCheck(-1),m_pTimer(nullptr),m_Recording(false),m_Account(account), m_PeerName(peerName),m_PeerPhoneNumber(peerNumber),m_CallId(callId),m_CurrentState(startState) { - qRegisterMetaType<Call*>(); +// qRegisterMetaType<Call*>(); changeCurrentState(startState); CallManagerInterface& callManager = DBus::CallManager::instance(); diff --git a/src/call.h b/src/call.h index 0950467e96412361b4c4a9cc9d3978e7c1e14de9..3756b7fbed373e83b7640ab4fa08aa6ca39f9a62 100644 --- a/src/call.h +++ b/src/call.h @@ -97,7 +97,10 @@ private: **/ class LIB_EXPORT Call : public QObject, public HistoryTreeBackend { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: //Enum enum Role { diff --git a/src/callmodel.cpp b/src/callmodel.cpp index d76723b8f77bced620dcd5c26235de121160c06c..eff0e367e2ba8e7f1195c27c322b60bdf1309926 100644 --- a/src/callmodel.cpp +++ b/src/callmodel.cpp @@ -96,7 +96,7 @@ CallModel::CallModel() : QAbstractItemModel(QCoreApplication::instance()) dbusInit = true; foreach(Call* call,HistoryModel::getHistory()){ - addCall(call,0); + addCall(call,nullptr); } } static bool m_sInstanceInit = false; @@ -586,7 +586,7 @@ int CallModel::rowCount( const QModelIndex& parentIdx ) const Qt::ItemFlags CallModel::flags( const QModelIndex& idx ) const { if (!idx.isValid()) - return 0; + return Qt::NoItemFlags; return Qt::ItemIsEnabled|Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | ((!idx.data(Call::Role::IsConference).toBool())?(Qt::ItemIsDropEnabled):Qt::ItemIsEnabled) @@ -934,7 +934,7 @@ void CallModel::slotCallChanged(Call* call) ///Add call slot void CallModel::slotAddPrivateCall(Call* call) { - addCall(call,0); + addCall(call,nullptr); } ///Notice views that a dtmf have been played diff --git a/src/callmodel.h b/src/callmodel.h index 360ee19421f80a86b1e1e2f8c5fb3d8092a42c6b..dc65f68d32e07d01b5c815078d378248f33c6a08 100644 --- a/src/callmodel.h +++ b/src/callmodel.h @@ -35,7 +35,10 @@ typedef QList<Call*> CallList; ///CallModel: Central model/frontend to deal with sflphoned class LIB_EXPORT CallModel : public QAbstractItemModel { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: //Constructors, initializer and destructors virtual ~CallModel( ); diff --git a/src/contact.h b/src/contact.h index e2df9fb1504bf132f520ca3651d4ad5c1ad9020c..9d504b99b415e432a1121d29b3bd8e78f05d481b 100644 --- a/src/contact.h +++ b/src/contact.h @@ -56,7 +56,10 @@ private: ///Contact: Abstract version of a contact class LIB_EXPORT Contact : public QObject, public ContactTreeBackend { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: ///PhoneNumber: represent a phone number class PhoneNumber { diff --git a/src/contactproxymodel.cpp b/src/contactproxymodel.cpp index 7993cf4eb5eb026baf941f57603a103b5ad3f4a7..02f99bf0f7ef5db6dcd85aa58610677b0a8f1017 100644 --- a/src/contactproxymodel.cpp +++ b/src/contactproxymodel.cpp @@ -223,7 +223,7 @@ int ContactProxyModel::rowCount( const QModelIndex& parent ) const Qt::ItemFlags ContactProxyModel::flags( const QModelIndex& index ) const { if (!index.isValid()) - return 0; + return Qt::NoItemFlags; return Qt::ItemIsEnabled | Qt::ItemIsSelectable | (index.parent().isValid()?Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled:Qt::ItemIsEnabled); } diff --git a/src/contactproxymodel.h b/src/contactproxymodel.h index 55dba0b9dae7b67e0532ee0bbe0a0ec3d971f23a..e59e23533a66bcf774901f3b661de0d9540257b5 100644 --- a/src/contactproxymodel.h +++ b/src/contactproxymodel.h @@ -29,7 +29,10 @@ class AbstractContactBackend; class LIB_EXPORT ContactProxyModel : public QAbstractItemModel { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: friend class AbstractContactBackend; explicit ContactProxyModel(AbstractContactBackend* parent,int role = Qt::DisplayRole, bool showAll = false); diff --git a/src/credentialmodel.h b/src/credentialmodel.h index 279a72488ec06e8c8a5970031180e15d96627e04..3b34d4f50f7e299a16319e6faa1131526377d947 100644 --- a/src/credentialmodel.h +++ b/src/credentialmodel.h @@ -25,7 +25,10 @@ ///CredentialModel: A model for account credentials class LIB_EXPORT CredentialModel : public QAbstractListModel { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" Q_OBJECT + #pragma GCC diagnostic pop public: //Roles enum Role { diff --git a/src/historymodel.cpp b/src/historymodel.cpp index 5d971daeb8d070343338bd00d32dcaa2736eb5d9..1e0a78581d822abc6dd00251aa5e70b787233eae 100644 --- a/src/historymodel.cpp +++ b/src/historymodel.cpp @@ -348,7 +348,7 @@ int HistoryModel::rowCount( const QModelIndex& parentIdx ) const Qt::ItemFlags HistoryModel::flags( const QModelIndex& idx ) const { if (!idx.isValid()) - return 0; + return Qt::NoItemFlags; return Qt::ItemIsEnabled | Qt::ItemIsSelectable | (idx.parent().isValid()?Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled:Qt::ItemIsEnabled); } diff --git a/src/historymodel.h b/src/historymodel.h index fb175e16d4b83edf367718139f480f4008ba90de..2f92bb22266e090883cb8424519f80a896d3d79d 100644 --- a/src/historymodel.h +++ b/src/historymodel.h @@ -34,7 +34,10 @@ typedef QList<Call*> CallList; ///HistoryModel: History call manager class LIB_EXPORT HistoryModel : public QAbstractItemModel { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: enum class HistoryConst : int { Today = 0 , diff --git a/src/instantmessagingmodel.cpp b/src/instantmessagingmodel.cpp index a40bd8ce276dc43e64d4ebae160dbdb9741c3044..393b71ec4eee1ad1ae5dd6b39740b458f458602b 100644 --- a/src/instantmessagingmodel.cpp +++ b/src/instantmessagingmodel.cpp @@ -40,7 +40,7 @@ void InstantMessagingModelManager::init(CallModel* model) { } ///Constructor -InstantMessagingModelManager::InstantMessagingModelManager() : QObject(0) +InstantMessagingModelManager::InstantMessagingModelManager() : QObject(nullptr) { CallManagerInterface& callManager = DBus::CallManager::instance(); connect(&callManager, SIGNAL(incomingMessage(QString,QString,QString)), this, SLOT(newMessage(QString,QString,QString))); diff --git a/src/instantmessagingmodel.h b/src/instantmessagingmodel.h index 20976db209cda049e87f4cdc72cbc6c2b722a023..63e904015db3893ecd9d74ddaf4ac0d2d9e5c8c2 100644 --- a/src/instantmessagingmodel.h +++ b/src/instantmessagingmodel.h @@ -39,7 +39,10 @@ class InstantMessagingModel; ///Manager for all IM conversations class LIB_EXPORT InstantMessagingModelManager : public QObject { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" Q_OBJECT + #pragma GCC diagnostic pop public: //Singleton @@ -72,7 +75,10 @@ Q_SIGNALS: ///Qt model for the Instant Messaging (IM) features class LIB_EXPORT InstantMessagingModel : public QAbstractListModel { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" Q_OBJECT + #pragma GCC diagnostic pop friend class InstantMessagingModelManager; friend class Call; public: diff --git a/src/typedefs.h b/src/typedefs.h index f4910051b812f501f7cefeb5d608d851efd17ef4..30364bcf78e816a9b740fedc38f0dc29e987ef78 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -70,13 +70,13 @@ struct TypedStateMachine #define nullptr 0 #endif -#ifdef ENABLE_IGNORE_NULL -#define IGNORE_NULL(content) \ -_Pragma(STRINGIFY(GCC diagnostic push))\ - _Pragma(STRINGIFY(GCC diagnostic ignored "-Wzero-as-null-pointer-constant")\ - content\ - _Pragma(STRINGIFY(GCC diagnostic pop) +//Doesn't work +#if ((__GNUC_MINOR__ > 8) || (__GNUC_MINOR__ == 8)) + #define STRINGIFY(x) #x + #define IGNORE_NULL(content)\ + _Pragma(STRINGIFY(GCC diagnostic ignored "-Wzero-as-null-pointer-constant")) \ + content #else -#define IGNORE_NULL(content) content + #define IGNORE_NULL(content) content #endif //ENABLE_IGNORE_NULL #endif diff --git a/src/videocodecmodel.h b/src/videocodecmodel.h index f343ad52e02f871ce36045eee53da2a5ecd922ae..2a9439538cbcccf11e31739694ca11b77304b9a5 100644 --- a/src/videocodecmodel.h +++ b/src/videocodecmodel.h @@ -33,7 +33,10 @@ typedef QHash<QString,VideoCodec*> CodecHash; ///Abstract model for managing account video codec list class LIB_EXPORT VideoCodecModel : public QAbstractListModel { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" Q_OBJECT + #pragma GCC diagnostic pop friend class Account; public: //Roles diff --git a/src/videomodel.h b/src/videomodel.h index 4e0e1877775153c6cd0524a6d76aa2e44c7dfd29..9c4b200670f82c0a31e492e8d72da17969981b46 100644 --- a/src/videomodel.h +++ b/src/videomodel.h @@ -32,7 +32,10 @@ struct SHMHeader; ///VideoModel: Video event dispatcher class LIB_EXPORT VideoModel : public QObject { - IGNORE_NULL(Q_OBJECT) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + Q_OBJECT + #pragma GCC diagnostic pop public: //Singleton static VideoModel* instance(); diff --git a/src/videorenderer.cpp b/src/videorenderer.cpp index 9363189d96ab359b816c8af3d1a1a5a2f5f0d81b..10a45221cfc2202eeccb093cca381a2f51d47f88 100644 --- a/src/videorenderer.cpp +++ b/src/videorenderer.cpp @@ -48,7 +48,7 @@ struct SHMHeader { }; ///Constructor -VideoRenderer::VideoRenderer(QString shmPath, Resolution res): QObject(0), +VideoRenderer::VideoRenderer(QString shmPath, Resolution res): QObject(nullptr), m_Width(0), m_Height(0), m_ShmPath(QString()), fd(-1), m_pShmArea((SHMHeader*)MAP_FAILED), m_ShmAreaLen(0), m_BufferGen(0), m_isRendering(false),m_pTimer(nullptr),m_Res(res) @@ -144,7 +144,10 @@ bool VideoRenderer::startShm() return false; } m_ShmAreaLen = sizeof(SHMHeader); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" m_pShmArea = (SHMHeader*) mmap(NULL, m_ShmAreaLen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + #pragma GCC diagnostic pop if (m_pShmArea == MAP_FAILED) { qDebug() << "Could not map shm area, mmap failed"; return false; @@ -177,11 +180,14 @@ bool VideoRenderer::resizeShm() return false; } + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" m_pShmArea = (SHMHeader*) mmap(NULL, new_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + #pragma GCC diagnostic pop m_ShmAreaLen = new_size; if (!m_pShmArea) { - m_pShmArea = 0; + m_pShmArea = nullptr; qDebug() << "Could not remap shared area"; return false; } diff --git a/src/videorenderer.h b/src/videorenderer.h index b151d37f2355bb968ee912c65fb6a4f6e4849e85..cb109f34cb382750e88b989296fb84ba57b151a6 100644 --- a/src/videorenderer.h +++ b/src/videorenderer.h @@ -31,7 +31,10 @@ struct SHMHeader; ///Manage shared memory and convert it to QByteArray class LIB_EXPORT VideoRenderer : public QObject { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" Q_OBJECT + #pragma GCC diagnostic pop public: //Constructor