[Libreoffice-commits] .: sdext/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Feb 11 04:38:23 PST 2011


 sdext/source/minimizer/pppoptimizertoken.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 74fa32edabf0765b0c9dbba01161b0d2aed81278
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 11 12:38:16 2011 +0000

    (std|boost)::hash on a const char* hashes the pointer not the contents

diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx
index b625547..5fbfb16 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -35,6 +35,13 @@
 #include <boost/unordered_map.hpp>
 #include <string.h>
 
+struct THash
+{
+    size_t operator()( const char* s ) const
+    {
+        return rtl_str_hashCode(s);
+    }
+};
 struct TCheck
 {
     bool operator()( const char* s1, const char* s2 ) const
@@ -42,7 +49,7 @@ struct TCheck
         return strcmp( s1, s2 ) == 0;
     }
 };
-typedef boost::unordered_map< const char*, PPPOptimizerTokenEnum, boost::hash<const char*>, TCheck> TypeNameHashMap;
+typedef boost::unordered_map< const char*, PPPOptimizerTokenEnum, THash, TCheck> TypeNameHashMap;
 static TypeNameHashMap* pHashMap = NULL;
 static ::osl::Mutex& getHashMapMutex()
 {


More information about the Libreoffice-commits mailing list