From 476f9f9a0c149fece23ec56f1a9ae05acaef9aaf Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 11 Feb 2011 12:51:58 +0000 Subject: (std|boost)::hash on a const char* hashes the pointer not the contents --- oox/source/export/shapes.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'oox') diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 624713cbc4d2..3950f293a280 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -318,6 +318,14 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] { "mso-spt202", "rect" } }; +struct StringHash +{ + size_t operator()( const char* s ) const + { + return rtl_str_hashCode(s); + } +}; + struct StringCheck { bool operator()( const char* s1, const char* s2 ) const @@ -326,7 +334,7 @@ struct StringCheck } }; -typedef boost::unordered_map< const char*, const char*, boost::hash, StringCheck> CustomShapeTypeTranslationHashMap; +typedef boost::unordered_map< const char*, const char*, StringHash, StringCheck> CustomShapeTypeTranslationHashMap; static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL; static const char* lcl_GetPresetGeometry( const char* sShapeType ) @@ -869,7 +877,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape ) } typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > ); -typedef boost::unordered_map< const char*, ShapeConverter, boost::hash, StringCheck> NameToConvertMapType; +typedef boost::unordered_map< const char*, ShapeConverter, StringHash, StringCheck> NameToConvertMapType; static const NameToConvertMapType& lcl_GetConverters() { -- cgit