mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-10 23:52:51 -04:00
turned some std::list<PeerId> into std::set, as it automatically prevents duplicates
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8138 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f1309a8cbe
commit
c9d5c7b3cb
51 changed files with 269 additions and 266 deletions
|
@ -1178,7 +1178,7 @@ std::ostream &RsPeerGroupItem::print(std::ostream &out, uint16_t indent)
|
|||
printIndent(out, int_Indent);
|
||||
out << "groupFlag: " << flag << std::endl;
|
||||
|
||||
std::list<RsPgpId>::iterator it;
|
||||
std::set<RsPgpId>::iterator it;
|
||||
for (it = pgpList.ids.begin(); it != pgpList.ids.end(); ++it) {
|
||||
printIndent(out, int_Indent);
|
||||
out << "peerId: " << it->toStdString() << std::endl;
|
||||
|
|
|
@ -123,7 +123,7 @@ std::ostream& RsPluginHashSetItem::print(std::ostream& o, uint16_t)
|
|||
o << "Item type: RsPluginHashSetItem" << std::endl;
|
||||
o << " Hash list: " << std::endl;
|
||||
|
||||
for(std::list<Sha1CheckSum>::const_iterator it(hashes.ids.begin());it!=hashes.ids.end();++it)
|
||||
for(std::set<Sha1CheckSum>::const_iterator it(hashes.ids.begin());it!=hashes.ids.end();++it)
|
||||
o << " " << *it << std::endl;
|
||||
|
||||
return o ;
|
||||
|
|
|
@ -59,7 +59,7 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||
/* start at data[offset] */
|
||||
ok = ok && SetTlvBase(data, tlvend, offset, TLV_TYPE, tlvsize);
|
||||
|
||||
for(typename std::list<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
for(typename std::set<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
ok = ok && (*it).serialise(data,tlvend,*offset) ;
|
||||
|
||||
return ok ;
|
||||
|
@ -91,7 +91,7 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||
{
|
||||
ID_CLASS id ;
|
||||
ok = ok && id.deserialise(data,tlvend,*offset) ;
|
||||
ids.push_back(id) ;
|
||||
ids.insert(id) ;
|
||||
}
|
||||
if(*offset != tlvend)
|
||||
std::cerr << "(EE) deserialisaiton error in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
|
@ -99,20 +99,20 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
|
|||
}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t /* indent */) const
|
||||
{
|
||||
for(typename std::list<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
for(typename std::set<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
out << (*it).toStdString() << ", " ;
|
||||
|
||||
return out ;
|
||||
}
|
||||
virtual std::ostream &printHex(std::ostream &out, uint16_t /* indent */) const /* SPECIAL One */
|
||||
{
|
||||
for(typename std::list<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
for(typename std::set<ID_CLASS>::const_iterator it(ids.begin());it!=ids.end();++it)
|
||||
out << (*it).toStdString() << ", " ;
|
||||
|
||||
return out ;
|
||||
}
|
||||
|
||||
std::list<ID_CLASS> ids ;
|
||||
std::set<ID_CLASS> ids ;
|
||||
};
|
||||
|
||||
typedef t_RsTlvIdSet<RsPeerId,TLV_TYPE_PEERSET> RsTlvPeerIdSet ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue