diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-02-11 12:51:58 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-02-11 12:51:58 +0000 |
commit | 476f9f9a0c149fece23ec56f1a9ae05acaef9aaf (patch) | |
tree | 760aa2096039c9d5f18a6ec451ecb0bd0b7d6742 /oox | |
parent | 9b5a0fd92230348b7c524305cdd249d0df709db0 (diff) |
(std|boost)::hash on a const char* hashes the pointer not the contents
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/shapes.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
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<const char*>, 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<const char*>, StringCheck> NameToConvertMapType; +typedef boost::unordered_map< const char*, ShapeConverter, StringHash, StringCheck> NameToConvertMapType; static const NameToConvertMapType& lcl_GetConverters() { |