From 4bf5bc1274d7da738f499505fa3d6cae6d01860a Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 22 Feb 2019 23:16:45 +0100 Subject: [PATCH 01/12] Fix clang warnings for ../../../trunk/libretroshare/src/services/autoproxy/ rsautoproxymonitor.cc:263:24: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] ^ ../../../trunk/libretroshare/src/services/autoproxy/ rsautoproxymonitor.cc:295:24: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] ^ ./../../trunk/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp: 723: warning: pragma diagnostic pop could not pop, no matching push [- Wunknown-pragmas] ^ --- libretroshare/src/services/autoproxy/rsautoproxymonitor.cc | 2 ++ retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc b/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc index aef160590..d198bd207 100644 --- a/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc +++ b/libretroshare/src/services/autoproxy/rsautoproxymonitor.cc @@ -258,6 +258,7 @@ void rsAutoProxyMonitor::taskDone(taskTicket *t, autoProxyStatus::autoProxyStatu if (cleanUp) { if (t->data) { std::cerr << "(WW) rsAutoProxyMonitor::taskFinish will try to delete void pointer!" << std::endl; +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdelete-incomplete" delete t->data; #pragma GCC diagnostic pop @@ -290,6 +291,7 @@ void rsAutoProxyMonitor::taskFinished(taskTicket *&ticket) // clean up if (ticket->data) { std::cerr << "rsAutoProxyMonitor::taskFinished data set. Will try to delete void pointer" << std::endl; +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdelete-incomplete" delete ticket->data; #pragma GCC diagnostic pop diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index c9f912420..564cf9d66 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -717,6 +717,7 @@ private: // we pack the couple (id of DL, id of source) into a single 32-bits pointer that is required by the AbstractItemModel class. +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" uint32_t src = uint32_t( *reinterpret_cast(&ref) & TRANSFERS_NB_SOURCES_BIT_MASK_32BITS ) ; uint32_t ntr = ( *reinterpret_cast(&ref)) >> TRANSFERS_NB_SOURCES_BITS_32BITS ; From b46e07191f89056cfbb317eb650cac4ecf01876c Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 22 Feb 2019 23:20:57 +0100 Subject: [PATCH 02/12] Fix clang warning for In file included from ../../../trunk/libretroshare/src/turtle/ p3turtle.cc:30: In file included from ../../../trunk/libretroshare/src/rsserver/p3face.h: 38: In file included from ../../../trunk/libretroshare/src/chat/ p3chatservice.h:30: In file included from ../../../trunk/libretroshare/src/rsitems/ rsmsgitems.h:34: In file included from ../../../trunk/libretroshare/src/grouter/ grouteritems.h:32: In file included from ../../../trunk/libretroshare/src/grouter/ groutermatrix.h:29: In file included from ../../../trunk/libretroshare/src/grouter/ groutertypes.h:28: ../../../trunk/libretroshare/src/turtle/p3turtle.h:447:8: warning: private field '_force_digg_new_tunnels' is not used [-Wunused-private- field] bool _force_digg_new_tunnels ; ^ --- libretroshare/src/turtle/p3turtle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index ad60cf7f2..a80025c28 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -444,7 +444,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config std::list _online_peers; /// used to force digging new tunnels - bool _force_digg_new_tunnels ; + //bool _force_digg_new_tunnels ; /// used as a bias to introduce randomness in a consistent way, for /// altering tunnel request depths, and tunnel re-routing actions. From dd7c658ed133d2cf34bced272c3b19282e361b2d Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 22 Feb 2019 23:27:40 +0100 Subject: [PATCH 03/12] Fix clang warning for In file included from ../../../trunk/libretroshare/src/gxs/rsgxsutil.cc: 26: ../../../trunk/libretroshare/src/gxs/rsgxsutil.h:217:16: warning: private field 'mSerializer' is not used [-Wunused-private-field] RsSerialType& mSerializer; ^ --- libretroshare/src/gxs/rsgxsutil.cc | 5 ++++- libretroshare/src/gxs/rsgxsutil.h | 8 +++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index de7644ab4..88ceac305 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -148,7 +148,10 @@ bool RsGxsMessageCleanUp::clean() RsGxsIntegrityCheck::RsGxsIntegrityCheck( RsGeneralDataService* const dataService, RsGenExchange* genex, RsSerialType& serializer, RsGixs* gixs ) : - mDs(dataService), mGenExchangeClient(genex), mSerializer(serializer), + mDs(dataService), mGenExchangeClient(genex), +#ifdef RS_DEEP_SEARCH + mSerializer(serializer), +#endif mDone(false), mIntegrityMutex("integrity"), mGixs(gixs) {} void RsGxsIntegrityCheck::run() diff --git a/libretroshare/src/gxs/rsgxsutil.h b/libretroshare/src/gxs/rsgxsutil.h index d4770303e..c1a610a3d 100644 --- a/libretroshare/src/gxs/rsgxsutil.h +++ b/libretroshare/src/gxs/rsgxsutil.h @@ -21,8 +21,7 @@ * * *******************************************************************************/ -#ifndef GXSUTIL_H_ -#define GXSUTIL_H_ +#pragma once #include #include "rsitems/rsnxsitems.h" @@ -214,8 +213,9 @@ private: RsGeneralDataService* const mDs; RsGenExchange *mGenExchangeClient; +#ifdef RS_DEEP_SEARCH RsSerialType& mSerializer; - +#endif bool mDone; RsMutex mIntegrityMutex; std::list mDeletedGrps; @@ -262,5 +262,3 @@ public: GxsMsgReq mMsgs ; uint32_t mToken; }; - -#endif /* GXSUTIL_H_ */ From 54b708089f95a07be4449301c5267ce71935f912 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 17:10:00 +0100 Subject: [PATCH 04/12] Fix clang warnings for ../../../trunk/libresapi/src/api/FileSearchHandler.cpp:53:66: warning: unused parameter 'pid' [-Wunused-parameter] void FileSearchHandler::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id, const std::list& files) ^ In file included from ../../../trunk/libresapi/src/api/ FileSearchHandler.cpp:24: ../../../trunk/libresapi/src/api/FileSearchHandler.h:48:15: warning: private field 'mTurtle' is not used [-Wunused-private-field] RsTurtle* mTurtle; ^ --- libresapi/src/api/FileSearchHandler.cpp | 6 +++--- libresapi/src/api/FileSearchHandler.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libresapi/src/api/FileSearchHandler.cpp b/libresapi/src/api/FileSearchHandler.cpp index 7f719aa5b..ceb3765c9 100644 --- a/libresapi/src/api/FileSearchHandler.cpp +++ b/libresapi/src/api/FileSearchHandler.cpp @@ -32,8 +32,8 @@ namespace resource_api { -FileSearchHandler::FileSearchHandler(StateTokenServer *sts, RsNotify *notify, RsTurtle *turtle, RsFiles *files): - mStateTokenServer(sts), mNotify(notify), mTurtle(turtle), mRsFiles(files), +FileSearchHandler::FileSearchHandler(StateTokenServer *sts, RsNotify *notify, RsTurtle */*turtle*/, RsFiles *files): + mStateTokenServer(sts), mNotify(notify)/*, mTurtle(turtle)*/, mRsFiles(files), mMtx("FileSearchHandler") { mNotify->registerNotifyClient(this); @@ -50,7 +50,7 @@ FileSearchHandler::~FileSearchHandler() mStateTokenServer->discardToken(mSearchesStateToken); } -void FileSearchHandler::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id, const std::list& files) +void FileSearchHandler::notifyTurtleSearchResult(const RsPeerId& /*pid*/,uint32_t search_id, const std::list& files) { RS_STACK_MUTEX(mMtx); // ********** LOCKED ********** std::map::iterator mit = mSearches.find(search_id); diff --git a/libresapi/src/api/FileSearchHandler.h b/libresapi/src/api/FileSearchHandler.h index 7e9b294b1..ec1585eef 100644 --- a/libresapi/src/api/FileSearchHandler.h +++ b/libresapi/src/api/FileSearchHandler.h @@ -45,7 +45,7 @@ private: StateTokenServer* mStateTokenServer; RsNotify* mNotify; - RsTurtle* mTurtle; + //RsTurtle* mTurtle; RsFiles* mRsFiles; class Search{ From e2d64c912e0f423e5b67203c82ba94d4871a5f45 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 17:18:09 +0100 Subject: [PATCH 05/12] Fix clang warning for ../../../trunk/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp: 1104:9: warning: enumeration value 'DownloadTab' not handled in switch [-Wswitch] switch(page) ^ --- retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index 564cf9d66..15b57e6d8 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -1109,6 +1109,8 @@ void TransfersDialog::activatePage(TransfersDialog::Page page) break ; case TransfersDialog::RemoteSharedFilesTab: ui.tabWidget->setCurrentWidget(remoteSharedFiles) ; break ; + case TransfersDialog::DownloadTab: ui.tabWidget->setCurrentWidget(ui.tab) ; + break ; } } From 9310be075d6a03d5a8e6966a5f1850bb61ffc892 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 17:40:44 +0100 Subject: [PATCH 06/12] Fix clang warning for ../../../trunk/retroshare-gui/src/gui/Posted/PostedDialog.cpp:99:10: warning: enumeration value 'ICON_SEARCH' not handled in switch [- Wswitch] switch (type) { ^ --- retroshare-gui/src/gui/Posted/PostedDialog.cpp | 2 ++ retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp index 320618cab..419339bcc 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedDialog.cpp @@ -109,6 +109,8 @@ QString PostedDialog::icon(IconType type) return ":/icons/png/feed-popular.png"; case ICON_OTHER_GROUP: return ":/icons/png/feed-other.png"; + case ICON_SEARCH: + return ":/images/find.png"; case ICON_DEFAULT: return ""; } diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp index 116e2fe02..84e903335 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp @@ -125,6 +125,8 @@ QString GxsForumsDialog::icon(IconType type) return ":/icons/png/feed-popular.png"; case ICON_OTHER_GROUP: return ":/icons/png/feed-other.png"; + case ICON_SEARCH: + return ":/images/find.png"; case ICON_DEFAULT: return ":/icons/png/forums-default.png"; } From b2c596595016b097f06670168ffc80bd9f149eb4 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 17:46:39 +0100 Subject: [PATCH 07/12] Fix clang warning for ../../../trunk/libretroshare/src/ft/ftserver.cc:1230:23: warning: unused variable 'ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE' [-Wunused-const- variable] static const uint32_t ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE = 12 ; ^ ../../../trunk/libretroshare/src/ft/ftserver.cc:1231:23: warning: unused variable 'ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE' [-Wunused-const- variable] static const uint32_t ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE = 16 ; ^ ../../../trunk/libretroshare/src/ft/ftserver.cc:1232:23: warning: unused variable 'ENCRYPTED_FT_HEADER_SIZE' [-Wunused-const-variable] static const uint32_t ENCRYPTED_FT_HEADER_SIZE = 4 ; ^ ../../../trunk/libretroshare/src/ft/ftserver.cc:1233:23: warning: unused variable 'ENCRYPTED_FT_EDATA_SIZE' [-Wunused-const-variable] static const uint32_t ENCRYPTED_FT_EDATA_SIZE = 4 ; ^ ../../../trunk/libretroshare/src/ft/ftserver.cc:1235:23: warning: unused variable 'ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305' [-Wunused-const- variable] static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305 = 0x01 ; ^ ../../../trunk/libretroshare/src/ft/ftserver.cc:1236:23: warning: unused variable 'ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256' [-Wunused-const- variable] static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; ^ --- libretroshare/src/ft/ftserver.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 906bae6f1..8d429eda4 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -1227,6 +1227,7 @@ void ftServer::deriveEncryptionKey(const RsFileHash& hash, uint8_t *key) SHA256_Final (key, &sha_ctx); } +#ifdef USE_NEW_METHOD static const uint32_t ENCRYPTED_FT_INITIALIZATION_VECTOR_SIZE = 12 ; static const uint32_t ENCRYPTED_FT_AUTHENTICATION_TAG_SIZE = 16 ; static const uint32_t ENCRYPTED_FT_HEADER_SIZE = 4 ; @@ -1234,7 +1235,7 @@ static const uint32_t ENCRYPTED_FT_EDATA_SIZE = 4 ; static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_POLY1305 = 0x01 ; static const uint8_t ENCRYPTED_FT_FORMAT_AEAD_CHACHA20_SHA256 = 0x02 ; - +#endif //USE_NEW_METHOD bool ftServer::encryptItem(RsTurtleGenericTunnelItem *clear_item,const RsFileHash& hash,RsTurtleGenericDataItem *& encrypted_item) { From 78f9bbfd75a6f6be231703a392eb6277e091bf80 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 17:47:59 +0100 Subject: [PATCH 08/12] Fix clang warning for ../../../trunk/libretroshare/src/pqi/authssl.cc:57:16: warning: unused variable 'RS_SSL_HANDSHAKE_DIAGNOSTIC_KEY_ALGORITHM_NOT_ACCEPTED' [- Wunused-const-variable] const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_KEY_ALGORITHM_NOT_ACCEPTED = 0x08 ; ^ --- libretroshare/src/pqi/authssl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index 797786783..cec288c58 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -54,7 +54,7 @@ const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_MALLOC_ERROR = 0x04 ; const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_WRONG_SIGNATURE = 0x05 ; const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_CERTIFICATE_MISSING = 0x06 ; const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_HASH_ALGORITHM_NOT_ACCEPTED = 0x07 ; -const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_KEY_ALGORITHM_NOT_ACCEPTED = 0x08 ; +//const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_KEY_ALGORITHM_NOT_ACCEPTED = 0x08 ; const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_WRONG_SIGNATURE_TYPE = 0x09 ; const uint32_t RS_SSL_HANDSHAKE_DIAGNOSTIC_WRONG_SIGNATURE_VERSION = 0x0a ; From bc8d2a79c065c4898f31f374a5c35d9a61a97894 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 17:59:22 +0100 Subject: [PATCH 09/12] Fix clang warning for ../../../trunk/libretroshare/src/gxs/rsgxsutil.cc:150:23: warning: unused parameter 'serializer' [-Wunused-parameter] RsSerialType& serializer, RsGixs* gixs ) : ^ --- libretroshare/src/gxs/rsgxsutil.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsutil.cc b/libretroshare/src/gxs/rsgxsutil.cc index 88ceac305..14b93cda8 100644 --- a/libretroshare/src/gxs/rsgxsutil.cc +++ b/libretroshare/src/gxs/rsgxsutil.cc @@ -146,9 +146,13 @@ bool RsGxsMessageCleanUp::clean() } RsGxsIntegrityCheck::RsGxsIntegrityCheck( - RsGeneralDataService* const dataService, RsGenExchange* genex, - RsSerialType& serializer, RsGixs* gixs ) : - mDs(dataService), mGenExchangeClient(genex), + RsGeneralDataService* const dataService, RsGenExchange* genex, + RsSerialType& +#ifdef RS_DEEP_SEARCH + serializer +#endif + , RsGixs* gixs ) + : mDs(dataService), mGenExchangeClient(genex), #ifdef RS_DEEP_SEARCH mSerializer(serializer), #endif From 07a31ee5f5153e33a4e9193c41621cc21cb9ee52 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 18:17:11 +0100 Subject: [PATCH 10/12] Fix clang warning for ../../../trunk/retroshare-gui/src/gui/People/IdentityWidget.cpp:111:10: warning: explicitly assigning value of variable of type 'QImage' to itself [-Wself-assign-overloaded] image = image; ~~~~~ ^ ~~~~~ --- retroshare-gui/src/gui/People/IdentityWidget.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/retroshare-gui/src/gui/People/IdentityWidget.cpp b/retroshare-gui/src/gui/People/IdentityWidget.cpp index 64f1873d9..deaa7b8f5 100644 --- a/retroshare-gui/src/gui/People/IdentityWidget.cpp +++ b/retroshare-gui/src/gui/People/IdentityWidget.cpp @@ -110,13 +110,11 @@ void IdentityWidget::updateData(const RsGxsIdGroup &gxs_group_info) ui->labelKeyId->setText(_keyId); ui->labelKeyId->setVisible(false); - /// (TODO) Get real ident icon - QImage image; - - if(_group_info.mImage.mSize > 0 && image.loadFromData(_group_info.mImage.mData, _group_info.mImage.mSize, "PNG")) - image = image; - else - image = GxsIdDetails::makeDefaultIcon(RsGxsId(_group_info.mMeta.mGroupId)); + /// (TODO) Get real ident icon + QImage image; + + if(!( (_group_info.mImage.mSize > 0) && image.loadFromData(_group_info.mImage.mData, _group_info.mImage.mSize, "PNG") )) + image = GxsIdDetails::makeDefaultIcon(RsGxsId(_group_info.mMeta.mGroupId)); if (_avatar != image) { _avatar = image; From d96b9b054ba186881fcf855ffc6c5f0fa8c604d0 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 23 Feb 2019 19:28:45 +0100 Subject: [PATCH 11/12] Fix clang warnings for ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 106:53: warning: unused parameter 'parent' [-Wunused-parameter] int RsGxsForumModel::columnCount(const QModelIndex &parent) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:245:3: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 248:12: warning: comparison of integers of different signs: 'int' and 'std::vector::size_type' (aka 'unsigned long') [-Wsign-compare] if(row >= mPosts[entry].mChildren.size()) ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 299:67: warning: unused parameter 'orientation' [-Wunused-parameter] QVariant RsGxsForumModel::headerData(int section, Qt::Orientation orientation, int role) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 398:77: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::textColorRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 419:74: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::filterRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 498:75: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 540:74: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 548:78: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 806:111: warning: unused parameter 'useChildTS' [-Wunused-parameter] void RsGxsForumModel::convertMsgToPostEntry(const RsGxsForumGroup& mForumGroup,const RsMsgMetaData& msg, bool useChildTS, ForumModelPostEntry& fentry) ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:828:7: warning: unused variable 'redacted' [-Wunused-variable] bool redacted = false; ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:880:6: warning: unused variable 'pos' [-Wunused-variable] int pos = 0; ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:879:6: warning: unused variable 'count' [-Wunused-variable] int count = msgs.size(); ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:882:6: warning: unused variable 'step' [-Wunused-variable] int step = 0; ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 949:26: warning: comparison of integers of different signs: 'int32_t' (aka 'int') and 'std::vector::size_type' (aka 'unsigned long') [-Wsign- compare] for(int32_t i=0;isecond.size();++j) ~^~~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 991:26: warning: comparison of integers of different signs: 'int32_t' (aka 'int') and 'std::vector::size_type' (aka 'unsigned long') [-Wsign- compare] for(int32_t i=1;isecond.size();++i) ~^~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 1005:22: warning: comparison of integers of different signs: 'int' and 'std::vector::size_type' (aka 'unsigned long') [-Wsign-compare] for(int i=1;isecond.size();++i) ~^~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/ GxsForumThreadWidget.cpp:1038:13: warning: unused function 'cleanupItems' [-Wunused-function] static void cleanupItems (QList &items) ^ --- .../src/gui/gxsforums/GxsForumModel.cpp | 67 +++++++++++-------- .../gui/gxsforums/GxsForumThreadWidget.cpp | 11 --- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index c9fc624c1..500d97667 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -103,7 +103,7 @@ int RsGxsForumModel::rowCount(const QModelIndex& parent) const return getChildrenCount(parent.internalPointer()); } -int RsGxsForumModel::columnCount(const QModelIndex &parent) const +int RsGxsForumModel::columnCount(const QModelIndex &/*parent*/) const { return COLUMN_THREAD_NB_COLUMNS ; } @@ -229,6 +229,9 @@ Qt::ItemFlags RsGxsForumModel::flags(const QModelIndex& index) const void *RsGxsForumModel::getChildRef(void *ref,int row) const { + if (row < 0) + return nullptr; + ForumModelIndex entry ; if(!convertRefPointerToTabEntry(ref,entry) || entry >= mPosts.size()) @@ -236,16 +239,20 @@ void *RsGxsForumModel::getChildRef(void *ref,int row) const void *new_ref; - if(mTreeMode == TREE_MODE_FLAT) - if(entry == 0) - { + if(mTreeMode == TREE_MODE_FLAT) + { + if(entry == 0) + { convertTabEntryToRefPointer(row+1,new_ref); - return new_ref; - } + return new_ref; + } else - return NULL ; + { + return NULL ; + } + } - if(row >= mPosts[entry].mChildren.size()) + if(static_cast(row) >= mPosts[entry].mChildren.size()) return NULL; convertTabEntryToRefPointer(mPosts[entry].mChildren[row],new_ref); @@ -296,7 +303,7 @@ int RsGxsForumModel::getChildrenCount(void *ref) const return mPosts[entry].mChildren.size(); } -QVariant RsGxsForumModel::headerData(int section, Qt::Orientation orientation, int role) const +QVariant RsGxsForumModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const { if(role == Qt::DisplayRole) switch(section) @@ -395,7 +402,7 @@ QVariant RsGxsForumModel::data(const QModelIndex &index, int role) const } } -QVariant RsGxsForumModel::textColorRole(const ForumModelPostEntry& fmpe,int column) const +QVariant RsGxsForumModel::textColorRole(const ForumModelPostEntry& fmpe,int /*column*/) const { if( (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING)) return QVariant(mTextColorMissing); @@ -416,7 +423,7 @@ QVariant RsGxsForumModel::statusRole(const ForumModelPostEntry& fmpe,int column) return QVariant(fmpe.mMsgStatus); } -QVariant RsGxsForumModel::filterRole(const ForumModelPostEntry& fmpe,int column) const +QVariant RsGxsForumModel::filterRole(const ForumModelPostEntry& fmpe,int /*column*/) const { if(!mFilteringEnabled || (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_CHILDREN_PASSES_FILTER)) return QVariant(FilterString); @@ -495,7 +502,7 @@ void RsGxsForumModel::setFilter(int column,const QStringList& strings,uint32_t& postMods(); } -QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int column) const +QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int /*column*/) const { if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING) return QVariant(true); @@ -537,7 +544,7 @@ QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column return QVariant(); } -QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int column) const +QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int /*column*/) const { if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED) return QVariant(true); @@ -545,7 +552,7 @@ QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int column) return QVariant(false); } -QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int column) const +QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int /*column*/) const { if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED) return QVariant(QBrush(QColor(255,200,180))); @@ -803,7 +810,7 @@ void RsGxsForumModel::generateMissingItem(const RsGxsMessageId &msgId,ForumModel entry.mReputationWarningLevel = 3; } -void RsGxsForumModel::convertMsgToPostEntry(const RsGxsForumGroup& mForumGroup,const RsMsgMetaData& msg, bool useChildTS, ForumModelPostEntry& fentry) +void RsGxsForumModel::convertMsgToPostEntry(const RsGxsForumGroup& mForumGroup,const RsMsgMetaData& msg, bool /*useChildTS*/, ForumModelPostEntry& fentry) { fentry.mTitle = msg.mMsgName; fentry.mAuthorId = msg.mAuthorId; @@ -877,10 +884,12 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou msgs[msgs_metas_array[i].mMsgId] = msgs_metas_array[i] ; } - int count = msgs.size(); - int pos = 0; +#ifdef DEBUG_FORUMS + size_t count = msgs.size(); +#endif +// int pos = 0; // int steps = count / PROGRESSBAR_MAX; - int step = 0; +// int step = 0; initEmptyHierarchy(posts); @@ -947,8 +956,8 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou { auto& v(it->second) ; - for(int32_t i=0;ifirst) { RsGxsMessageId sub_msg_id = v[i].second ; @@ -957,14 +966,14 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou if(it2 != mPostVersions.end()) { - for(int32_t j=0;jsecond.size();++j) + for(size_t j=0;jsecond.size();++j) if(it2->second[j].second != sub_msg_id) // dont copy it, since it is already present at slot i v.push_back(it2->second[j]) ; mPostVersions.erase(it2) ; // it2 is never equal to it } } - } + } } @@ -989,23 +998,23 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou #ifdef DEBUG_FORUMS std::cerr << " most recent version " << (*it)[0].first << " " << (*it)[0].second << std::endl; #endif - for(int32_t i=1;isecond.size();++i) - { + for(size_t i=1;isecond.size();++i) + { msgs.erase(it->second[i].second) ; #ifdef DEBUG_FORUMS - std::cerr << " older version " << (*it)[i].first << " " << (*it)[i].second << std::endl; + std::cerr << " older version " << (*it)[i].first << " " << (*it)[i].second << std::endl; #endif - } + } mTmp[it->second[0].second] = it->second ; // index the versions map by the ID of the most recent post. // Now make sure that message parents are consistent. Indeed, an old post may have the old version of a post as parent. So we need to change that parent // to the newest version. So we create a map of which is the most recent version of each message, so that parent messages can be searched in it. - for(int i=1;isecond.size();++i) - most_recent_versions[it->second[i].second] = it->second[0].second ; - } + for(size_t i=1;isecond.size();++i) + most_recent_versions[it->second[i].second] = it->second[0].second ; + } mPostVersions = mTmp ; // The next step is to find the top level thread messages. These are defined as the messages without diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index f01c054e8..f3340c887 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1035,17 +1035,6 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index) #endif } -static void cleanupItems (QList &items) -{ - QList::iterator item; - for (item = items.begin (); item != items.end (); ++item) { - if (*item) { - delete (*item); - } - } - items.clear(); -} - static QString getDurationString(uint32_t days) { switch(days) From 5cb59548821304f8c331d449b742f018ecfbdd7c Mon Sep 17 00:00:00 2001 From: Phenom Date: Sun, 24 Feb 2019 00:37:42 +0100 Subject: [PATCH 12/12] Fix clang warning for ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 1266:13: warning: function 'recursPrintModel' is not needed and will not be emitted [-Wunneeded-internal-declaration] static void recursPrintModel(const std::vector& entries,ForumModelIndex index,int depth) ^ --- retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index 500d97667..38495f204 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -1264,6 +1264,7 @@ QModelIndex RsGxsForumModel::getIndexOfMessage(const RsGxsMessageId& mid) const return QModelIndex(); } +#ifdef DEBUG_FORUMMODEL static void recursPrintModel(const std::vector& entries,ForumModelIndex index,int depth) { const ForumModelPostEntry& e(entries[index]); @@ -1280,7 +1281,6 @@ static void recursPrintModel(const std::vector& entries,For recursPrintModel(entries,e.mChildren[i],depth+1); } -#ifdef DEBUG_FORUMMODEL void RsGxsForumModel::debug_dump() { std::cerr << "Model data dump:" << std::endl;