mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1485 from PhenomRetroShare/Fix_ClangWarnings
Fix clang warnings
This commit is contained in:
commit
044d1cc765
@ -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<TurtleFileInfo>& files)
|
||||
void FileSearchHandler::notifyTurtleSearchResult(const RsPeerId& /*pid*/,uint32_t search_id, const std::list<TurtleFileInfo>& files)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
std::map<uint32_t, Search>::iterator mit = mSearches.find(search_id);
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
|
||||
StateTokenServer* mStateTokenServer;
|
||||
RsNotify* mNotify;
|
||||
RsTurtle* mTurtle;
|
||||
//RsTurtle* mTurtle;
|
||||
RsFiles* mRsFiles;
|
||||
|
||||
class Search{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -146,9 +146,16 @@ bool RsGxsMessageCleanUp::clean()
|
||||
}
|
||||
|
||||
RsGxsIntegrityCheck::RsGxsIntegrityCheck(
|
||||
RsGeneralDataService* const dataService, RsGenExchange* genex,
|
||||
RsSerialType& serializer, RsGixs* gixs ) :
|
||||
mDs(dataService), mGenExchangeClient(genex), mSerializer(serializer),
|
||||
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
|
||||
mDone(false), mIntegrityMutex("integrity"), mGixs(gixs) {}
|
||||
|
||||
void RsGxsIntegrityCheck::run()
|
||||
|
@ -21,8 +21,7 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef GXSUTIL_H_
|
||||
#define GXSUTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#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<RsGxsGroupId> mDeletedGrps;
|
||||
@ -262,5 +262,3 @@ public:
|
||||
GxsMsgReq mMsgs ;
|
||||
uint32_t mToken;
|
||||
};
|
||||
|
||||
#endif /* GXSUTIL_H_ */
|
||||
|
@ -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 ;
|
||||
|
||||
|
@ -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
|
||||
|
@ -444,7 +444,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
|
||||
std::list<pqipeer> _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.
|
||||
|
@ -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<uint32_t*>(&ref) & TRANSFERS_NB_SOURCES_BIT_MASK_32BITS ) ;
|
||||
uint32_t ntr = ( *reinterpret_cast<uint32_t*>(&ref)) >> TRANSFERS_NB_SOURCES_BITS_32BITS ;
|
||||
@ -1108,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 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -109,7 +109,9 @@ QString PostedDialog::icon(IconType type)
|
||||
case ICON_POPULAR_GROUP:
|
||||
return "";
|
||||
case ICON_OTHER_GROUP:
|
||||
return "";
|
||||
return ":/icons/png/feed-other.png";
|
||||
case ICON_SEARCH:
|
||||
return ":/images/find.png";
|
||||
case ICON_DEFAULT:
|
||||
return ":/icons/png/posted.png";
|
||||
}
|
||||
|
@ -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<size_t>(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;i<v.size();++i)
|
||||
{
|
||||
for(size_t i=0;i<v.size();++i)
|
||||
{
|
||||
if(v[i].second != it->first)
|
||||
{
|
||||
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;j<it2->second.size();++j)
|
||||
for(size_t j=0;j<it2->second.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;i<it->second.size();++i)
|
||||
{
|
||||
for(size_t i=1;i<it->second.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;i<it->second.size();++i)
|
||||
most_recent_versions[it->second[i].second] = it->second[0].second ;
|
||||
}
|
||||
for(size_t i=1;i<it->second.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
|
||||
@ -1255,6 +1264,7 @@ QModelIndex RsGxsForumModel::getIndexOfMessage(const RsGxsMessageId& mid) const
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FORUMMODEL
|
||||
static void recursPrintModel(const std::vector<ForumModelPostEntry>& entries,ForumModelIndex index,int depth)
|
||||
{
|
||||
const ForumModelPostEntry& e(entries[index]);
|
||||
@ -1271,7 +1281,6 @@ static void recursPrintModel(const std::vector<ForumModelPostEntry>& entries,For
|
||||
recursPrintModel(entries,e.mChildren[i],depth+1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FORUMMODEL
|
||||
void RsGxsForumModel::debug_dump()
|
||||
{
|
||||
std::cerr << "Model data dump:" << std::endl;
|
||||
|
@ -1035,17 +1035,6 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cleanupItems (QList<QTreeWidgetItem *> &items)
|
||||
{
|
||||
QList<QTreeWidgetItem *>::iterator item;
|
||||
for (item = items.begin (); item != items.end (); ++item) {
|
||||
if (*item) {
|
||||
delete (*item);
|
||||
}
|
||||
}
|
||||
items.clear();
|
||||
}
|
||||
|
||||
static QString getDurationString(uint32_t days)
|
||||
{
|
||||
switch(days)
|
||||
|
@ -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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user