summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-11-21 20:40:14 +0000
committerMike Buland <eichlan@xagasoft.com>2006-11-21 20:40:14 +0000
commitd43af5161421dc38eb7b38e49ec66608866b2cce (patch)
tree45296ddc83e9f4c9e8d0d74a331954a9eaf158e9 /src
parent8fbf5fda24392d2a2ee19d6f40699a5de29da662 (diff)
downloadlibbu++-d43af5161421dc38eb7b38e49ec66608866b2cce.tar.gz
libbu++-d43af5161421dc38eb7b38e49ec66608866b2cce.tar.bz2
libbu++-d43af5161421dc38eb7b38e49ec66608866b2cce.tar.xz
libbu++-d43af5161421dc38eb7b38e49ec66608866b2cce.zip
Nooow everything in the lib is clean with -Wall, hash was a template and didn't
complain until I ran the tests. The tests will be fixed next.
Diffstat (limited to 'src')
-rw-r--r--src/hash.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/hash.h b/src/hash.h
index 71abff5..dcf65ae 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -58,10 +58,10 @@ private:
58 58
59 Hash<key, _value, sizecalc, keyalloc, valuealloc, challoc> &hsh; 59 Hash<key, _value, sizecalc, keyalloc, valuealloc, challoc> &hsh;
60 key *pKey; 60 key *pKey;
61 uint32_t nPos;
61 _value *pValue; 62 _value *pValue;
62 bool bFilled;
63 uint32_t hash; 63 uint32_t hash;
64 uint32_t nPos; 64 bool bFilled;
65 65
66public: 66public:
67 operator _value() 67 operator _value()
@@ -121,6 +121,7 @@ public:
121 nFilled( 0 ), 121 nFilled( 0 ),
122 nDeleted( 0 ), 122 nDeleted( 0 ),
123 bFilled( NULL ), 123 bFilled( NULL ),
124 bDeleted( NULL ),
124 aKeys( NULL ), 125 aKeys( NULL ),
125 aValues( NULL ), 126 aValues( NULL ),
126 aHashCodes( NULL ) 127 aHashCodes( NULL )
@@ -249,9 +250,8 @@ public:
249 250
250 bool has( key k ) 251 bool has( key k )
251 { 252 {
252 uint32_t hash = __calcHashCode( k );
253 bool bFill; 253 bool bFill;
254 uint32_t nPos = probe( hash, k, bFill ); 254 probe( __calcHashCode( k ), k, bFill );
255 255
256 return bFill; 256 return bFill;
257 } 257 }
@@ -262,8 +262,8 @@ public:
262 private: 262 private:
263 iterator( Hash<key, value, sizecalc, keyalloc, valuealloc, challoc> &hsh ) : 263 iterator( Hash<key, value, sizecalc, keyalloc, valuealloc, challoc> &hsh ) :
264 hsh( hsh ), 264 hsh( hsh ),
265 bFinished( false ), 265 nPos( 0 ),
266 nPos( 0 ) 266 bFinished( false )
267 { 267 {
268 nPos = hsh.getFirstPos( bFinished ); 268 nPos = hsh.getFirstPos( bFinished );
269 } 269 }
@@ -276,7 +276,6 @@ public:
276 } 276 }
277 277
278 Hash<key, value, sizecalc, keyalloc, valuealloc, challoc> &hsh; 278 Hash<key, value, sizecalc, keyalloc, valuealloc, challoc> &hsh;
279
280 uint32_t nPos; 279 uint32_t nPos;
281 bool bFinished; 280 bool bFinished;
282 281
@@ -374,6 +373,7 @@ private:
374 } 373 }
375 374
376 bFinished = true; 375 bFinished = true;
376 return 0;
377 } 377 }
378 378
379 uint32_t getNextPos( uint32_t nPos, bool &bFinished ) 379 uint32_t getNextPos( uint32_t nPos, bool &bFinished )
@@ -386,6 +386,7 @@ private:
386 } 386 }
387 387
388 bFinished = true; 388 bFinished = true;
389 return 0;
389 } 390 }
390 391
391 uint32_t probe( uint32_t hash, key k, bool &bFill, bool rehash=true ) 392 uint32_t probe( uint32_t hash, key k, bool &bFill, bool rehash=true )
@@ -496,10 +497,10 @@ private:
496 uint32_t nDeleted; 497 uint32_t nDeleted;
497 uint32_t *bFilled; 498 uint32_t *bFilled;
498 uint32_t *bDeleted; 499 uint32_t *bDeleted;
499 uint32_t *aHashCodes;
500 uint32_t nKeysSize; 500 uint32_t nKeysSize;
501 value *aValues;
502 key *aKeys; 501 key *aKeys;
502 value *aValues;
503 uint32_t *aHashCodes;
503 valuealloc va; 504 valuealloc va;
504 keyalloc ka; 505 keyalloc ka;
505 challoc ca; 506 challoc ca;