From b797d7a7c4481c20b26ecf6ce7ef77e4782534bb Mon Sep 17 00:00:00 2001 From: David Date: Wed, 30 Aug 2006 00:34:28 +0000 Subject: david - creepy forgot to commit hashtable stuff... also fixed something in md5... it was using uninitialized data... --- src/hashfunctionstring.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/hashfunctionstring.cpp') 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 @@ #include "hashfunctionstring.h" +#ifndef NULL +#define NULL ((void *) 0) +#endif HashFunctionString::HashFunctionString() { @@ -10,6 +13,11 @@ HashFunctionString::~HashFunctionString() unsigned long int HashFunctionString::hash( const void *id ) { + if (id == NULL) + { + return 0; + } + unsigned long int nPos = 0; for( const char *s = (const char *)id; *s; s++ ) { @@ -20,6 +28,15 @@ unsigned long int HashFunctionString::hash( const void *id ) bool HashFunctionString::cmpIDs( const void *id1, const void *id2 ) { + if (id1 == NULL || id2 == NULL) + { + return false; + } + if (id1 == id2) + { + return true; + } + const char *str1 = (const char *)id1; const char *str2 = (const char *)id2; -- cgit v1.2.3