From 1587314e55ae761983803aa828addc6854bf4ad4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 1 May 2006 18:39:59 +0000 Subject: Fixed a bug in the get code of the hashtable. It now performs probing correctly according to the new high capacity duplicate probing algorithm. --- src/hashtable.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/hashtable.cpp b/src/hashtable.cpp index 9dfe653..49d9236 100644 --- a/src/hashtable.cpp +++ b/src/hashtable.cpp @@ -212,6 +212,27 @@ const void *HashTable::get( const void *id, unsigned long int nSkip ) } } + if( bAllowDupes ) + { + int nOldPos = nPos; + for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize ) + { + if( !isFilled( nPos ) ) return NULL; + if( hFunc->cmpIDs( id, aTable[nPos].id ) && + aTable[nPos].bDeleted == false ) + { + if( nSkip == 0 ) + { + return aTable[nPos].data; + } + else + { + nSkip--; + } + } + } + } + return NULL; } -- cgit v1.2.3