[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - cppuhelper/qa oox/inc oox/source sal/inc sdext/source svx/source vcl/source writerfilter/source xmloff/source
Ariel Constenla-Haile
arielch at apache.org
Wed May 8 18:10:37 PDT 2013
cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx | 18 -----------
oox/inc/oox/export/shapes.hxx | 2 -
oox/source/export/shapes.cxx | 12 +------
sal/inc/rtl/string.hxx | 23 +++++++++++++++
sdext/source/minimizer/pppoptimizertoken.cxx | 11 +------
svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx | 10 +-----
vcl/source/glyphs/gcach_ftyp.cxx | 3 -
writerfilter/source/resourcemodel/TagLogger.cxx | 10 ------
xmloff/source/draw/EnhancedCustomShapeToken.cxx | 11 +------
9 files changed, 35 insertions(+), 65 deletions(-)
New commits:
commit be3f41391a4eb370080be25c6857066a21cb6fdd
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Wed May 8 22:11:05 2013 +0000
Fix build breaker
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index bc9b670..0519b1a 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -131,7 +131,7 @@ FT_Error (*pFTEmbolden)(FT_GlyphSlot);
FT_Error (*pFTOblique)(FT_GlyphSlot);
static bool bEnableSizeFT = false;
-typedef ::std::hash_map< const char*, FtFontFile*, CStringHash, CStringEqual> FontFileList;
+typedef ::std::hash_map< const char*, FtFontFile*, rtl::CStringHash, rtl::CStringEqual> FontFileList;
namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFileList > {}; }
// -----------------------------------------------------------------------
commit b7e3470a154538a92f0a21b14e726d75723f4a92
Author: Herbert Dürr <hdu at apache.org>
Date: Wed May 8 15:17:19 2013 +0000
#i122208# use rtl::CStringHash and rtl::CStringEqual instead of relying on pre-tr1-stl specializations
In stlport<=4 the functors hash and equal_to had specializions for conveniently handling c-strings.
For consistency reasons this specialization was not included in the TR1 report and the C++11 standard.
The two new helper functors are drop-in replacements for the old specializations.
diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
index b63b408..6b21e43 100644
--- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
+++ b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
@@ -33,22 +33,6 @@ using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
-
-struct equalStr
-{
- bool operator()(
- const char * const &rA,
- const char * const &rB) const
- { return !strcmp(rA, rB); }
-};
-struct hashStr
-{
- size_t operator()( const char * &rName ) const
- {
- return rtl::OString(rName).hashCode();
- }
-};
-
class ContainerListener;
struct ContainerStats {
@@ -253,7 +237,7 @@ namespace cppu_ifcontainer
void testOMultiTypeInterfaceContainerHelperVar()
{
typedef ::cppu::OMultiTypeInterfaceContainerHelperVar<
- const char *,hashStr,equalStr> StrContainer;
+ const char*, rtl::CStringHash, rtl::CStringEqual> StrContainer;
const char *pTypes[nTests] =
{
diff --git a/oox/inc/oox/export/shapes.hxx b/oox/inc/oox/export/shapes.hxx
index 077ef93..6af7b91 100644
--- a/oox/inc/oox/export/shapes.hxx
+++ b/oox/inc/oox/export/shapes.hxx
@@ -62,7 +62,7 @@ private:
struct ShapeHash
{
- std::hash<const char*> maHashFunction;
+ rtl::CStringHash maHashFunction;
size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const;
};
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 49ae8d9..5b6c624 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -307,15 +307,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
{ "mso-spt202", "rect" }
};
-struct StringCheck
-{
- bool operator()( const char* s1, const char* s2 ) const
- {
- return strcmp( s1, s2 ) == 0;
- }
-};
-
-typedef std::hash_map< const char*, const char*, std::hash<const char*>, StringCheck> CustomShapeTypeTranslationHashMap;
+typedef std::hash_map< const char*, const char*, CStringHash, CStringEqual> CustomShapeTypeTranslationHashMap;
static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL;
static const char* lcl_GetPresetGeometry( const char* sShapeType )
@@ -869,7 +861,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape )
}
typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > );
-typedef std::hash_map< const char*, ShapeConverter, std::hash<const char*>, StringCheck> NameToConvertMapType;
+typedef std::hash_map< const char*, ShapeConverter, CStringHash, CStringEqual> NameToConvertMapType;
static const NameToConvertMapType& lcl_GetConverters()
{
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index fccf8d7..95e8ab3 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -930,8 +930,31 @@ struct OStringHash
/* ======================================================================= */
+/** Equality functor for classic c-strings (i.e. null-terminated char* strings) */
+struct CStringEqual
+{
+ bool operator()( const char* p1, const char* p2) const {
+ while( *p1)
+ if( *(p1++) != *(p2++))
+ return false;
+ return true;
+ }
+};
+
+/** Hashing functor for classic c-strings (i.e. null-terminated char* strings) */
+struct CStringHash
+{
+ size_t operator()( const char* p) const {
+ size_t n = 0;
+ while( *p)
+ n += 4*n + *(p++);
+ return n;
+ }
+};
+
} /* Namespace */
#endif /* __cplusplus */
#endif /* _RTL_STRING_HXX_ */
+
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx
index 5ba89be..2cbbc7e 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -27,16 +27,9 @@
#include "pppoptimizertoken.hxx"
#include <osl/mutex.hxx>
#include <hash_map>
-#include <string.h>
+#include <rtl/string.hxx>
-struct TCheck
-{
- bool operator()( const char* s1, const char* s2 ) const
- {
- return strcmp( s1, s2 ) == 0;
- }
-};
-typedef std::hash_map< const char*, PPPOptimizerTokenEnum, std::hash<const char*>, TCheck> TypeNameHashMap;
+typedef std::hash_map< const char*, PPPOptimizerTokenEnum, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
static TypeNameHashMap* pHashMap = NULL;
static ::osl::Mutex& getHashMapMutex()
{
diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
index 5b8b3da..2c4c9d7 100644
--- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -26,15 +26,9 @@
#include "svx/EnhancedCustomShapeTypeNames.hxx"
#include <osl/mutex.hxx>
#include <hash_map>
+#include "rtl/string.hxx"
-struct TCheck
-{
- bool operator()( const char* s1, const char* s2 ) const
- {
- return strcmp( s1, s2 ) == 0;
- }
-};
-typedef std::hash_map< const char*, MSO_SPT, std::hash<const char*>, TCheck> TypeNameHashMap;
+typedef std::hash_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
static TypeNameHashMap* pHashMap = NULL;
static ::osl::Mutex& getHashMapMutex()
{
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index 0bd2feb..bc9b670 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -131,8 +131,7 @@ FT_Error (*pFTEmbolden)(FT_GlyphSlot);
FT_Error (*pFTOblique)(FT_GlyphSlot);
static bool bEnableSizeFT = false;
-struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } };
-typedef ::std::hash_map<const char*,FtFontFile*,::std::hash<const char*>, EqStr> FontFileList;
+typedef ::std::hash_map< const char*, FtFontFile*, CStringHash, CStringEqual> FontFileList;
namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFileList > {}; }
// -----------------------------------------------------------------------
diff --git a/writerfilter/source/resourcemodel/TagLogger.cxx b/writerfilter/source/resourcemodel/TagLogger.cxx
index 6adb805..48d8ba7 100644
--- a/writerfilter/source/resourcemodel/TagLogger.cxx
+++ b/writerfilter/source/resourcemodel/TagLogger.cxx
@@ -224,15 +224,7 @@ ostream & XMLTag::output(ostream & o, const string & sIndent) const
return o;
}
-struct eqstr
-{
- bool operator()(const char* s1, const char* s2) const
- {
- return strcmp(s1, s2) == 0;
- }
-};
-
-typedef hash_map<const char *, TagLogger::Pointer_t, hash<const char *>, eqstr> TagLoggerHashMap_t;
+typedef hash_map< const char*, TagLogger::Pointer_t, rtl::CStringHash, rtl::CStringEqual> TagLoggerHashMap_t;
static TagLoggerHashMap_t * tagLoggers = NULL;
TagLogger::TagLogger()
diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
index e816f37..4012b49 100644
--- a/xmloff/source/draw/EnhancedCustomShapeToken.cxx
+++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
@@ -26,18 +26,11 @@
#include "EnhancedCustomShapeToken.hxx"
#include <osl/mutex.hxx>
#include <hash_map>
-#include <string.h>
+#include <rtl/string.hxx>
namespace xmloff { namespace EnhancedCustomShapeToken {
-struct TCheck
-{
- bool operator()( const char* s1, const char* s2 ) const
- {
- return strcmp( s1, s2 ) == 0;
- }
-};
-typedef std::hash_map< const char*, EnhancedCustomShapeTokenEnum, std::hash<const char*>, TCheck> TypeNameHashMap;
+typedef std::hash_map< const char*, EnhancedCustomShapeTokenEnum, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
static TypeNameHashMap* pHashMap = NULL;
static ::osl::Mutex& getHashMapMutex()
{
More information about the Libreoffice-commits
mailing list