Blame rpm-4.6.0-rc1-fp-hash.patch
|
Panu Matilainen |
18c868 |
diff --git a/lib/fprint.c b/lib/fprint.c
|
|
Panu Matilainen |
18c868 |
index d31a694..b763a38 100644
|
|
Panu Matilainen |
18c868 |
--- a/lib/fprint.c
|
|
Panu Matilainen |
18c868 |
+++ b/lib/fprint.c
|
|
Panu Matilainen |
18c868 |
@@ -183,16 +183,13 @@ unsigned int fpHashFunction(const void * key)
|
|
Panu Matilainen |
18c868 |
{
|
|
Panu Matilainen |
18c868 |
const fingerPrint * fp = key;
|
|
Panu Matilainen |
18c868 |
unsigned int hash = 0;
|
|
Panu Matilainen |
18c868 |
- char ch;
|
|
Panu Matilainen |
18c868 |
- const char * chptr;
|
|
Panu Matilainen |
18c868 |
+ int j;
|
|
Panu Matilainen |
18c868 |
|
|
Panu Matilainen |
18c868 |
- ch = 0;
|
|
Panu Matilainen |
18c868 |
- chptr = fp->baseName;
|
|
Panu Matilainen |
18c868 |
- while (*chptr != '\0') ch ^= *chptr++;
|
|
Panu Matilainen |
18c868 |
+ hash = hashFunctionString(fp->baseName);
|
|
Panu Matilainen |
18c868 |
+ if (fp->subDir) hash ^= hashFunctionString(fp->subDir);
|
|
Panu Matilainen |
18c868 |
|
|
Panu Matilainen |
18c868 |
- hash |= ((unsigned)ch) << 24;
|
|
Panu Matilainen |
18c868 |
- hash |= (((((unsigned)fp->entry->dev) >> 8) ^ fp->entry->dev) & 0xFF) << 16;
|
|
Panu Matilainen |
18c868 |
- hash |= fp->entry->ino & 0xFFFF;
|
|
Panu Matilainen |
18c868 |
+ hash ^= ((unsigned)fp->entry->dev);
|
|
Panu Matilainen |
18c868 |
+ for (j=0; j<4; j++) hash ^= ((fp->entry->ino >> (8*j)) & 0xFF) << ((3-j)*8);
|
|
Panu Matilainen |
18c868 |
|
|
Panu Matilainen |
18c868 |
return hash;
|
|
Panu Matilainen |
18c868 |
}
|