From b4ff953aa84b53ef801ad934bbbf2763ae063d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 11 Feb 2011 12:43:31 +0000 Subject: [PATCH] (std|boost)::hash on a const char* hashes the pointer not the contents --- svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx index 0667dff6d29a..66cf3d3aec49 100644 --- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx @@ -32,6 +32,13 @@ #include #include +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, TCheck> TypeNameHashMap; +typedef boost::unordered_map< const char*, MSO_SPT, THash, TCheck> TypeNameHashMap; static TypeNameHashMap* pHashMap = NULL; static ::osl::Mutex& getHashMapMutex() {