[Libreoffice-commits] .: svx/source

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


 svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 0f84ea5faee435252b167f5b91f60e2687fdb491
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 11 12:43:31 2011 +0000

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

diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
index dcab177..8239fff 100644
--- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -32,6 +32,13 @@
 #include <osl/mutex.hxx>
 #include <boost/unordered_map.hpp>
 
+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
@@ -39,7 +46,7 @@ struct TCheck
         return strcmp( s1, s2 ) == 0;
     }
 };
-typedef boost::unordered_map< const char*, MSO_SPT, boost::hash<const char*>, TCheck> TypeNameHashMap;
+typedef boost::unordered_map< const char*, MSO_SPT, THash, TCheck> TypeNameHashMap;
 static TypeNameHashMap* pHashMap = NULL;
 static ::osl::Mutex& getHashMapMutex()
 {


More information about the Libreoffice-commits mailing list