mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-12 16:15:43 -04:00
fixed feed bug by moving away from std::string as a return type to uniqueIdentifier(). Now uint64_ hash is used and cached
This commit is contained in:
parent
ff86d3cd20
commit
137cb5271d
22 changed files with 51 additions and 31 deletions
|
@ -18,10 +18,11 @@
|
|||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "FeedItem.h"
|
||||
|
||||
/** Constructor */
|
||||
FeedItem::FeedItem(QWidget *parent) : QWidget(parent)
|
||||
FeedItem::FeedItem(QWidget *parent) : QWidget(parent), mHash(0)
|
||||
{
|
||||
mWasExpanded = false;
|
||||
}
|
||||
|
@ -43,3 +44,18 @@ void FeedItem::expand(bool open)
|
|||
mWasExpanded = true;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t FeedItem::hash_64bits(const std::string& s) const
|
||||
{
|
||||
if(mHash == 0)
|
||||
{
|
||||
mHash = 0x01110bbfa09;
|
||||
|
||||
for(uint32_t i=0;i<s.size();++i)
|
||||
mHash = ~(((mHash << 31) ^ (mHash >> 3)) + s[i]*0x217898fbba7 + 0x0294379);
|
||||
|
||||
std::cerr << "Producing hash " << std::hex << mHash << std::dec << " from string \"" << s << "\"" << std::endl;
|
||||
}
|
||||
|
||||
return mHash;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue