diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
| commit | ac517a2b7625e0aa0862679e961c6349f859ea3b (patch) | |
| tree | e3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/hashfunctionstring.cpp | |
| parent | f8d4301e9fa4f3709258505941e37fab2eadadc6 (diff) | |
| parent | bd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff) | |
| download | libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2 libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip | |
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to '')
| -rw-r--r-- | src/hashfunctionstring.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/hashfunctionstring.cpp b/src/hashfunctionstring.cpp deleted file mode 100644 index bd14643..0000000 --- a/src/hashfunctionstring.cpp +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | #include "hashfunctionstring.h" | ||
| 2 | #ifndef NULL | ||
| 3 | #define NULL ((void *) 0) | ||
| 4 | #endif | ||
| 5 | |||
| 6 | HashFunctionString::HashFunctionString() | ||
| 7 | { | ||
| 8 | } | ||
| 9 | |||
| 10 | HashFunctionString::~HashFunctionString() | ||
| 11 | { | ||
| 12 | } | ||
| 13 | |||
| 14 | unsigned long int HashFunctionString::hash( const void *id ) | ||
| 15 | { | ||
| 16 | if (id == NULL) | ||
| 17 | { | ||
| 18 | return 0; | ||
| 19 | } | ||
| 20 | |||
| 21 | unsigned long int nPos = 0; | ||
| 22 | for( const char *s = (const char *)id; *s; s++ ) | ||
| 23 | { | ||
| 24 | nPos = *s + (nPos << 6) + (nPos << 16) - nPos; | ||
| 25 | } | ||
| 26 | return nPos; | ||
| 27 | } | ||
| 28 | |||
| 29 | bool HashFunctionString::cmpIDs( const void *id1, const void *id2 ) | ||
| 30 | { | ||
| 31 | if (id1 == NULL || id2 == NULL) | ||
| 32 | { | ||
| 33 | return false; | ||
| 34 | } | ||
| 35 | if (id1 == id2) | ||
| 36 | { | ||
| 37 | return true; | ||
| 38 | } | ||
| 39 | |||
| 40 | const char *str1 = (const char *)id1; | ||
| 41 | const char *str2 = (const char *)id2; | ||
| 42 | |||
| 43 | int j; | ||
| 44 | for( j = 0; str1[j] != '\0' && str2[j] != '\0'; j++ ) | ||
| 45 | { | ||
| 46 | if( str1[j] != str2[j] ) | ||
| 47 | return false; | ||
| 48 | } | ||
| 49 | return (str1[j]==str2[j]); | ||
| 50 | } | ||
| 51 | |||
