diff options
author | David <david@xagasoft.com> | 2006-08-30 00:34:28 +0000 |
---|---|---|
committer | David <david@xagasoft.com> | 2006-08-30 00:34:28 +0000 |
commit | b797d7a7c4481c20b26ecf6ce7ef77e4782534bb (patch) | |
tree | c16d8138d6e025ed2ba0f133cef0bd9c2c322638 /src/hashfunctionstring.cpp | |
parent | 5ff43b1a4abd06a47a996b817846567f8d1bc615 (diff) | |
download | libbu++-b797d7a7c4481c20b26ecf6ce7ef77e4782534bb.tar.gz libbu++-b797d7a7c4481c20b26ecf6ce7ef77e4782534bb.tar.bz2 libbu++-b797d7a7c4481c20b26ecf6ce7ef77e4782534bb.tar.xz libbu++-b797d7a7c4481c20b26ecf6ce7ef77e4782534bb.zip |
david - creepy forgot to commit hashtable stuff... also fixed something in md5... it was using uninitialized data...
Diffstat (limited to 'src/hashfunctionstring.cpp')
-rw-r--r-- | src/hashfunctionstring.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/hashfunctionstring.cpp b/src/hashfunctionstring.cpp index 6ce7bb3..bd14643 100644 --- a/src/hashfunctionstring.cpp +++ b/src/hashfunctionstring.cpp | |||
@@ -1,4 +1,7 @@ | |||
1 | #include "hashfunctionstring.h" | 1 | #include "hashfunctionstring.h" |
2 | #ifndef NULL | ||
3 | #define NULL ((void *) 0) | ||
4 | #endif | ||
2 | 5 | ||
3 | HashFunctionString::HashFunctionString() | 6 | HashFunctionString::HashFunctionString() |
4 | { | 7 | { |
@@ -10,6 +13,11 @@ HashFunctionString::~HashFunctionString() | |||
10 | 13 | ||
11 | unsigned long int HashFunctionString::hash( const void *id ) | 14 | unsigned long int HashFunctionString::hash( const void *id ) |
12 | { | 15 | { |
16 | if (id == NULL) | ||
17 | { | ||
18 | return 0; | ||
19 | } | ||
20 | |||
13 | unsigned long int nPos = 0; | 21 | unsigned long int nPos = 0; |
14 | for( const char *s = (const char *)id; *s; s++ ) | 22 | for( const char *s = (const char *)id; *s; s++ ) |
15 | { | 23 | { |
@@ -20,6 +28,15 @@ unsigned long int HashFunctionString::hash( const void *id ) | |||
20 | 28 | ||
21 | bool HashFunctionString::cmpIDs( const void *id1, const void *id2 ) | 29 | bool HashFunctionString::cmpIDs( const void *id1, const void *id2 ) |
22 | { | 30 | { |
31 | if (id1 == NULL || id2 == NULL) | ||
32 | { | ||
33 | return false; | ||
34 | } | ||
35 | if (id1 == id2) | ||
36 | { | ||
37 | return true; | ||
38 | } | ||
39 | |||
23 | const char *str1 = (const char *)id1; | 40 | const char *str1 = (const char *)id1; |
24 | const char *str2 = (const char *)id2; | 41 | const char *str2 = (const char *)id2; |
25 | 42 | ||