[Libreoffice-commits] .: sal/inc sal/osl sal/rtl

Fridrich Strba fridrich at kemper.freedesktop.org
Thu Feb 3 01:34:02 PST 2011


 sal/inc/osl/diagnose.hxx     |   13 +++++++++++++
 sal/inc/rtl/ustring.hxx      |    8 ++++++++
 sal/osl/all/debugbase.cxx    |    1 +
 sal/rtl/source/bootstrap.cxx |    5 +++++
 sal/rtl/source/unload.cxx    |   26 +++++++++++++++++++++++---
 5 files changed, 50 insertions(+), 3 deletions(-)

New commits:
commit 44f15749eeed72e35a61b7c64a16ce7d168fe983
Author: Fridrich Strba <fridrich.strba at bluewin.ch>
Date:   Thu Feb 3 02:29:46 2011 -0700

    include MSVC STL code path

diff --git a/sal/inc/osl/diagnose.hxx b/sal/inc/osl/diagnose.hxx
index 1cda133..e97d0be 100644
--- a/sal/inc/osl/diagnose.hxx
+++ b/sal/inc/osl/diagnose.hxx
@@ -96,8 +96,21 @@ struct VoidPtrHash : ::std::unary_function<void const*, ::std::size_t> {
     }
 };
 
+#ifdef USE_MSVC_HASH_SET
+namespace stdext
+{
+    inline ::std::size_t hash_value( void const* p ) {
+        ::std::size_t const d = static_cast< ::std::size_t >(
+            reinterpret_cast< ::std::ptrdiff_t >(p) );
+        return d + (d >> 3);
+    }
+}
+
+typedef ::std::hash_set<void const*> VoidPointerSet;
+#else
 typedef ::std::hash_set<void const*, VoidPtrHash, ::std::equal_to<void const*>,
                         ::rtl::Allocator<void const*> > VoidPointerSet;
+#endif
 
 struct ObjectRegistryData {
     ObjectRegistryData( ::std::type_info const& rTypeInfo )
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index b4b8f4c..cbb278b 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -1550,6 +1550,14 @@ inline OString OUStringToOString( const OUString & rUnicode,
 
 } /* Namespace */
 
+namespace stdext
+{
+    inline size_t hash_value(const rtl::OUString &rString)
+    {
+        return rtl::OUStringHash()(rString);
+    }
+}
+
 #endif /* __cplusplus */
 
 #endif /* _RTL_USTRING_HXX */
diff --git a/sal/osl/all/debugbase.cxx b/sal/osl/all/debugbase.cxx
index 1269324..44c9a76 100644
--- a/sal/osl/all/debugbase.cxx
+++ b/sal/osl/all/debugbase.cxx
@@ -36,6 +36,7 @@
 #include "osl/diagnose.hxx"
 #include "boost/bind.hpp"
 #include <vector>
+#include <algorithm>
 
 // define own ones, independent of OSL_DEBUG_LEVEL:
 #define DEBUGBASE_ENSURE_(c, f, l, m) \
diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx
index 75ba74e..7e2265c 100644
--- a/sal/rtl/source/bootstrap.cxx
+++ b/sal/rtl/source/bootstrap.cxx
@@ -606,10 +606,15 @@ namespace {
 struct bootstrap_map {
     // map<> may be preferred here, but hash_map<> is implemented fully inline,
     // thus there is no need to link against the stlport:
+#ifdef USE_MSVC_HASH_MAP
+    typedef std::hash_map<
+        rtl::OUString, Bootstrap_Impl *> t;
+#else
     typedef std::hash_map<
         rtl::OUString, Bootstrap_Impl *,
         rtl::OUStringHash, std::equal_to< rtl::OUString >,
         rtl::Allocator< OUString > > t;
+#endif
 
     // get and release must only be called properly synchronized via some mutex
     // (e.g., osl::Mutex::getGlobalMutex()):
diff --git a/sal/rtl/source/unload.cxx b/sal/rtl/source/unload.cxx
index 304e368..df7b243 100644
--- a/sal/rtl/source/unload.cxx
+++ b/sal/rtl/source/unload.cxx
@@ -157,6 +157,19 @@ struct hashModule
     }
 };
 
+#ifdef USE_MSVC_HASH_MAP
+namespace stdext
+{
+    inline size_t hash_value( const oslModule& rkey)
+    {
+        return (size_t)rkey;
+    }
+}
+
+typedef std::hash_map<
+    oslModule,
+    std::pair<sal_uInt32, component_canUnloadFunc> > ModuleMap;
+#else
 typedef std::hash_map<
     oslModule,
     std::pair<sal_uInt32, component_canUnloadFunc>,
@@ -164,6 +177,7 @@ typedef std::hash_map<
     std::equal_to<oslModule>,
     rtl::Allocator<oslModule>
 > ModuleMap;
+#endif
 
 typedef ModuleMap::iterator Mod_IT;
 
@@ -191,7 +205,7 @@ extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, T
         {
             rtl_copyMemory(libUnused, &that->unusedSince, sizeof(TimeValue));
         }
-    }	
+    }
     return (that->counter == 0);
 }
 
@@ -283,7 +297,7 @@ extern "C" void SAL_CALL rtl_unloadUnusedModules( TimeValue* libUnused)
                 // mark the module for later removal
                 unloadedModulesList.push_front( it->first);
             }
-        }	
+        }
     }
 
     // remove all entries containing invalid (unloaded) modules
@@ -306,6 +320,11 @@ struct hashListener
     }
 };
 
+#ifdef USE_MSVC_HASH_MAP
+typedef std::hash_map<
+    sal_Int32,
+    std::pair<rtl_unloadingListenerFunc, void*> > ListenerMap;
+#else
 typedef std::hash_map<
     sal_Int32,
     std::pair<rtl_unloadingListenerFunc, void*>,
@@ -313,6 +332,7 @@ typedef std::hash_map<
     std::equal_to<sal_Int32>,
     rtl::Allocator<sal_Int32>
 > ListenerMap;
+#endif
 
 typedef ListenerMap::iterator Lis_IT;
 
@@ -411,7 +431,7 @@ static void rtl_notifyUnloadingListeners()
 {
     ListenerMap& listenerMap= getListenerMap();
     for( Lis_IT it= listenerMap.begin(); it != listenerMap.end(); ++it)
-    {	
+    {
         rtl_unloadingListenerFunc callbackFunc= it->second.first;
         callbackFunc( it->second.second);
     }


More information about the Libreoffice-commits mailing list