[Libreoffice-commits] core.git: 2 commits - include/svl reportdesign/source sc/source sdext/source svl/qa svl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 7 07:52:48 UTC 2018


 include/svl/sharedstringpool.hxx          |    2 +-
 reportdesign/source/ui/misc/UITools.cxx   |    2 +-
 sc/source/core/data/documen2.cxx          |    2 +-
 sdext/source/presenter/PresenterTimer.cxx |   11 ++---------
 svl/qa/unit/svl.cxx                       |    4 ++--
 svl/source/misc/sharedstringpool.cxx      |   14 +++++---------
 6 files changed, 12 insertions(+), 23 deletions(-)

New commits:
commit 04fe6b033bc5e3f9eaef6bf7e1f8214e83ec7ba7
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 6 16:50:54 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 7 09:52:39 2018 +0200

    simplify TimerScheduler
    
    no need for a Deleter class
    
    Change-Id: Iee6e9218f4a81dad8c1e932e807dccf61666a0b3
    Reviewed-on: https://gerrit.libreoffice.org/58647
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sdext/source/presenter/PresenterTimer.cxx b/sdext/source/presenter/PresenterTimer.cxx
index 3bd1f9ab9977..0d0216ee2338 100644
--- a/sdext/source/presenter/PresenterTimer.cxx
+++ b/sdext/source/presenter/PresenterTimer.cxx
@@ -115,10 +115,7 @@ private:
 
     TimerScheduler(
         uno::Reference<uno::XComponentContext> const& xContext);
-    virtual ~TimerScheduler() override;
-    class Deleter {public: void operator () (TimerScheduler* pScheduler) { delete pScheduler; } };
-    friend class Deleter;
-
+public:
     virtual void SAL_CALL run() override;
     virtual void SAL_CALL onTerminated() override { mpLateDestroy.reset(); }
 };
@@ -194,7 +191,7 @@ std::shared_ptr<TimerScheduler> TimerScheduler::Instance(
     {
         if (!xContext.is())
             return nullptr;
-        mpInstance.reset(new TimerScheduler(xContext), TimerScheduler::Deleter());
+        mpInstance.reset(new TimerScheduler(xContext));
         mpInstance->create();
     }
     return mpInstance;
@@ -215,10 +212,6 @@ TimerScheduler::TimerScheduler(
     xDesktop->addTerminateListener(xListener);
 }
 
-TimerScheduler::~TimerScheduler()
-{
-}
-
 SharedTimerTask TimerScheduler::CreateTimerTask (
     const PresenterTimer::Task& rTask,
     const TimeValue& rDueTime,
commit ffdd06c2237f7dd935581e43c08d079b6a4337cd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 6 16:35:26 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 7 09:52:26 2018 +0200

    SharedStringPool is always called with a CharClass
    
    Change-Id: Ib2b9963a90a135998b6189fba521bd85f5579cf5
    Reviewed-on: https://gerrit.libreoffice.org/58645
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx
index 88adc1b48b79..a2cae3a9a08c 100644
--- a/include/svl/sharedstringpool.hxx
+++ b/include/svl/sharedstringpool.hxx
@@ -34,7 +34,7 @@ class SVL_DLLPUBLIC SharedStringPool
     SharedStringPool& operator=( const SharedStringPool& ) = delete;
 
 public:
-    SharedStringPool( const CharClass* pCharClass );
+    SharedStringPool( const CharClass& rCharClass );
     ~SharedStringPool();
 
     /**
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 42c172c2b818..f2ac0ebaf328 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -1023,7 +1023,7 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula
 
             LanguageTag aLangTag(LANGUAGE_SYSTEM);
             CharClass aCC(_xContext, aLangTag);
-            svl::SharedStringPool aStringPool(&aCC);
+            svl::SharedStringPool aStringPool(aCC);
 
             ScopedVclPtrInstance<FormulaDialog> aDlg(
                 pParent, xServiceFactory, pFormulaManager,
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index caf2df997831..46bff72a4a10 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -134,7 +134,7 @@ private:
 };
 
 ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
-        mpCellStringPool(new svl::SharedStringPool(ScGlobal::pCharClass)),
+        mpCellStringPool(new svl::SharedStringPool(*ScGlobal::pCharClass)),
         mpDocLinkMgr(new sc::DocumentLinkManager(pDocShell)),
         mpFormulaGroupCxt(nullptr),
         mbFormulaGroupCxtBlockDiscard(false),
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 69c1be6f853f..ec65d2962ccf 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -311,7 +311,7 @@ void Test::testSharedString()
 void Test::testSharedStringPool()
 {
     SvtSysLocale aSysLocale;
-    svl::SharedStringPool aPool(aSysLocale.GetCharClassPtr());
+    svl::SharedStringPool aPool(*aSysLocale.GetCharClassPtr());
 
     svl::SharedString p1, p2;
     p1 = aPool.intern("Andy");
@@ -344,7 +344,7 @@ void Test::testSharedStringPool()
 void Test::testSharedStringPoolPurge()
 {
     SvtSysLocale aSysLocale;
-    svl::SharedStringPool aPool(aSysLocale.GetCharClassPtr());
+    svl::SharedStringPool aPool(*aSysLocale.GetCharClassPtr());
     aPool.intern("Andy");
     aPool.intern("andy");
     aPool.intern("ANDY");
diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx
index 64993497957b..af1d80ef65d0 100644
--- a/svl/source/misc/sharedstringpool.cxx
+++ b/svl/source/misc/sharedstringpool.cxx
@@ -52,13 +52,13 @@ struct SharedStringPool::Impl
     StrHashType maStrPool;
     StrHashType maStrPoolUpper;
     StrStoreType maStrStore;
-    const CharClass* mpCharClass;
+    const CharClass& mrCharClass;
 
-    explicit Impl( const CharClass* pCharClass ) : mpCharClass(pCharClass) {}
+    explicit Impl( const CharClass& rCharClass ) : mrCharClass(rCharClass) {}
 };
 
-SharedStringPool::SharedStringPool( const CharClass* pCharClass ) :
-    mpImpl(new Impl(pCharClass)) {}
+SharedStringPool::SharedStringPool( const CharClass& rCharClass ) :
+    mpImpl(new Impl(rCharClass)) {}
 
 SharedStringPool::~SharedStringPool()
 {
@@ -72,10 +72,6 @@ SharedString SharedStringPool::intern( const OUString& rStr )
 
     rtl_uString* pOrig = aRes.first->pData;
 
-    if (!mpImpl->mpCharClass)
-        // We don't track case insensitive strings.
-        return SharedString(pOrig, nullptr);
-
     if (!aRes.second)
     {
         // No new string has been inserted. Return the existing string in the pool.
@@ -88,7 +84,7 @@ SharedString SharedStringPool::intern( const OUString& rStr )
 
     // This is a new string insertion. Establish mapping to upper-case variant.
 
-    OUString aUpper = mpImpl->mpCharClass->uppercase(rStr);
+    OUString aUpper = mpImpl->mrCharClass.uppercase(rStr);
     aRes = findOrInsert(mpImpl->maStrPoolUpper, aUpper);
     assert(aRes.first != mpImpl->maStrPoolUpper.end());
 


More information about the Libreoffice-commits mailing list