- Florian's improved fingerprinting hash algorithm from upstream

This commit is contained in:
Panu Matilainen 2008-10-28 14:24:04 +00:00
parent b94c245215
commit 18c8687d69
2 changed files with 32 additions and 1 deletions

View File

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

View File

@ -18,7 +18,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: 0.%{snapver}.5
Release: 0.%{snapver}.6
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -37,6 +37,7 @@ Patch200: rpm-4.6.0-rc1-permit-tab.patch
Patch201: rpm-4.6.0-rc1-skip-equal-nevr.patch
Patch202: rpm-4.6.0-rc1-noarch-subpkg.patch
Patch203: rpm-4.6.0-rc1-defaultdocdir.patch
Patch204: rpm-4.6.0-rc1-fp-hash.patch
# These are not yet upstream
Patch300: rpm-4.5.90-posttrans.patch
@ -174,6 +175,7 @@ that will manipulate RPM packages and databases.
%patch201 -p1 -b .skip-equal-nevr
%patch202 -p1 -b .noarch-subpkg
%patch203 -p1 -b .defaultdocdir
%patch204 -p1 -b .fp-hash
# needs a bit of upstream love first...
#%patch300 -p1 -b .posttrans
@ -364,6 +366,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Tue Oct 28 2008 Panu Matilainen <pmatilai@redhat.com>
- Florian's improved fingerprinting hash algorithm from upstream
* Sat Oct 25 2008 Panu Matilainen <pmatilai@redhat.com>
- Make noarch sub-packages actually work
- Fix defaultdocdir logic in installplatform to avoid hardwiring mandir