[Libreoffice-commits] .: oox/source

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


 oox/source/export/shapes.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit f78e97348d279a6f4475410e699f7f3e79ff63d7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 11 12:51:58 2011 +0000

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

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 1d61df3..c902c8b 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()
 {


More information about the Libreoffice-commits mailing list