mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdecore: use qChecksum() for hashing KConfigIniBackend::BufferFragment objects
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
6428341a30
commit
81018cc798
1 changed files with 2 additions and 12 deletions
|
@ -185,19 +185,9 @@ private:
|
|||
|
||||
uint qHash(const KConfigIniBackend::BufferFragment& fragment)
|
||||
{
|
||||
const uchar *p = reinterpret_cast<const uchar*>(fragment.constData());
|
||||
const char *p = fragment.constData();
|
||||
const int len = fragment.length();
|
||||
|
||||
// This algorithm is copied from qhash.cpp (Qt5 version).
|
||||
// Sadly this code is not accessible from the outside without going through abstraction
|
||||
// layers. Even QByteArray::fromRawData would do an allocation internally...
|
||||
uint h = 0;
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
h = 31 * h + p[i];
|
||||
}
|
||||
|
||||
return h;
|
||||
return qChecksum(p, len);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue