[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 19 08:52:46 UTC 2019


 sc/inc/colorscale.hxx                          |   10 +++++-----
 sc/qa/unit/ucalc_condformat.cxx                |   12 ++++++------
 sc/source/core/data/colorscale.cxx             |    8 ++++----
 sc/source/filter/oox/condformatbuffer.cxx      |    2 +-
 sc/source/filter/xml/xmlcondformat.cxx         |    2 +-
 sc/source/ui/condformat/condformatdlgentry.cxx |    2 +-
 sc/source/ui/view/cellsh1.cxx                  |   10 +++++-----
 7 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 752cc49c97b9c88f37d9a451050beaeab2d2e5cf
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 18 10:45:22 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Nov 19 09:51:57 2019 +0100

    cid#1399259 Uncaught exception
    
    Change-Id: Ia811eeb04cb9ab86aea205aa848e210fc34ab9d6
    Reviewed-on: https://gerrit.libreoffice.org/83072
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 8a6639de636c..a45f97d15d9e 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -56,7 +56,7 @@ public:
     ScColorScaleEntry();
     ScColorScaleEntry(const ScColorScaleEntry& rEntry);
     ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry& rEntry);
-    ~ScColorScaleEntry() COVERITY_NOEXCEPT_FALSE;
+    ~ScColorScaleEntry();
 
     const Color& GetColor() const { return maColor;}
     void SetColor(const Color&);
@@ -182,8 +182,8 @@ struct SC_DLLPUBLIC ScDataBarFormatData
      */
     bool mbOnlyBar;
 
-    std::unique_ptr<ScColorScaleEntry> mpUpperLimit;
-    std::unique_ptr<ScColorScaleEntry> mpLowerLimit;
+    std::unique_ptr<ScColorScaleEntry, o3tl::default_delete<ScColorScaleEntry>> mpUpperLimit;
+    std::unique_ptr<ScColorScaleEntry, o3tl::default_delete<ScColorScaleEntry>> mpLowerLimit;
 };
 
 enum ScIconSetType
@@ -248,7 +248,7 @@ private:
     mutable std::unique_ptr<ScColorFormatCache> mpCache;
 };
 
-typedef std::vector<std::unique_ptr<ScColorScaleEntry>> ScColorScaleEntries;
+typedef std::vector<std::unique_ptr<ScColorScaleEntry, o3tl::default_delete<ScColorScaleEntry>>> ScColorScaleEntries;
 
 class SC_DLLPUBLIC ScColorScaleFormat final : public ScColorFormat
 {
@@ -337,7 +337,7 @@ struct ScIconSetFormatData
      * Specifies whether the icons should be shown in reverse order
      */
     bool mbReverse;
-    typedef std::vector<std::unique_ptr<ScColorScaleEntry>> Entries_t;
+    typedef std::vector<std::unique_ptr<ScColorScaleEntry, o3tl::default_delete<ScColorScaleEntry>>> Entries_t;
     Entries_t m_Entries;
     bool mbCustom;
     // the std::pair points to exactly one image
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 6fbcb54a4880..31dddda3de55 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -559,9 +559,9 @@ void Test::testIconSet()
 
     ScIconSetFormat* pEntry = new ScIconSetFormat(m_pDoc);
     ScIconSetFormatData* pData = new ScIconSetFormatData;
-    pData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(0, COL_BLUE));
-    pData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(1, COL_GREEN));
-    pData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(2, COL_RED));
+    pData->m_Entries.emplace_back(new ScColorScaleEntry(0, COL_BLUE));
+    pData->m_Entries.emplace_back(new ScColorScaleEntry(1, COL_GREEN));
+    pData->m_Entries.emplace_back(new ScColorScaleEntry(2, COL_RED));
     pEntry->SetIconSetData(pData);
 
     m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1);
@@ -1211,9 +1211,9 @@ void Test::testCondFormatListenToOwnRange()
 
     ScIconSetFormat* pEntry = new ScIconSetFormat(m_pDoc);
     ScIconSetFormatData* pData = new ScIconSetFormatData;
-    pData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(0, COL_BLUE));
-    pData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(1, COL_GREEN));
-    pData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(2, COL_RED));
+    pData->m_Entries.emplace_back(new ScColorScaleEntry(0, COL_BLUE));
+    pData->m_Entries.emplace_back(new ScColorScaleEntry(1, COL_GREEN));
+    pData->m_Entries.emplace_back(new ScColorScaleEntry(2, COL_RED));
     pEntry->SetIconSetData(pData);
     pEntry->SetParent(pFormat.get());
 
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 64c0d990c147..774b477b3948 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -197,7 +197,7 @@ ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry&
     }
 }
 
-ScColorScaleEntry::~ScColorScaleEntry() COVERITY_NOEXCEPT_FALSE
+ScColorScaleEntry::~ScColorScaleEntry()
 {
     if(mpCell)
         mpCell->EndListeningTo(mpCell->GetDocument());
@@ -376,7 +376,7 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleForma
 {
     for(const auto& rxEntry : rFormat)
     {
-        maColorScales.push_back(std::make_unique<ScColorScaleEntry>(pDoc, *rxEntry));
+        maColorScales.emplace_back(new ScColorScaleEntry(pDoc, *rxEntry));
     }
 }
 
@@ -400,7 +400,7 @@ void ScColorScaleFormat::SetParent(ScConditionalFormat* pFormat)
 
 void ScColorScaleFormat::AddEntry( ScColorScaleEntry* pEntry )
 {
-    maColorScales.push_back(std::unique_ptr<ScColorScaleEntry>( pEntry ));
+    maColorScales.push_back(std::unique_ptr<ScColorScaleEntry, o3tl::default_delete<ScColorScaleEntry>>(pEntry));
     maColorScales.back()->SetRepaintCallback(mpParent);
 }
 
@@ -977,7 +977,7 @@ ScIconSetFormatData::ScIconSetFormatData(ScIconSetFormatData const& rOther)
     m_Entries.reserve(rOther.m_Entries.size());
     for (auto const& it : rOther.m_Entries)
     {
-        m_Entries.push_back(std::make_unique<ScColorScaleEntry>(*it));
+        m_Entries.emplace_back(new ScColorScaleEntry(*it));
     }
 }
 
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 4f38888e90c3..748cdb91a342 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -382,7 +382,7 @@ void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScA
     for(const ColorScaleRuleModelEntry & rEntry : maEntries)
     {
         ScColorScaleEntry* pModelEntry = ConvertToModel( rEntry, pDoc, rPos );
-        mxFormatData->m_Entries.push_back(std::unique_ptr<ScColorScaleEntry>(pModelEntry));
+        mxFormatData->m_Entries.emplace_back(pModelEntry);
     }
 
     mxFormatData->eIconSetType = getType(maIconSetType);
diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index 8e35ab868443..bd056a8a77c3 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -615,7 +615,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL ScXMLIconSetF
             {
                 ScColorScaleEntry* pEntry(nullptr);
                 pContext = new ScXMLFormattingEntryContext( GetScImport(), pAttribList, pEntry );
-                mpFormatData->m_Entries.push_back(std::unique_ptr<ScColorScaleEntry>(pEntry));
+                mpFormatData->m_Entries.emplace_back(pEntry);
                 pEntry->SetRepaintCallback(mpParent);
             }
             break;
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 4471ea81f80b..8c83b502647e 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1513,7 +1513,7 @@ ScFormatEntry* ScIconSetFrmtEntry::GetEntry() const
     pData->eIconSetType = static_cast<ScIconSetType>(mxLbIconSetType->get_active());
     for(const auto& rxEntry : maEntries)
     {
-        pData->m_Entries.push_back(std::unique_ptr<ScColorScaleEntry>(rxEntry->CreateEntry(mpDoc, maPos)));
+        pData->m_Entries.emplace_back(rxEntry->CreateEntry(mpDoc, maPos));
     }
     pFormat->SetIconSetData(pData);
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 44ef3d49c330..d530cc81cbcd 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1989,13 +1989,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     ScIconSetFormat* pEntry = new ScIconSetFormat(pDoc);
                     ScIconSetFormatData* pIconSetFormatData = new ScIconSetFormatData(eIconSetType);
 
-                    pIconSetFormatData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(0, COL_RED, COLORSCALE_PERCENT));
-                    pIconSetFormatData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(round(100. / nSteps), COL_BROWN, COLORSCALE_PERCENT));
-                    pIconSetFormatData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(round(200. / nSteps), COL_YELLOW, COLORSCALE_PERCENT));
+                    pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(0, COL_RED, COLORSCALE_PERCENT));
+                    pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(100. / nSteps), COL_BROWN, COLORSCALE_PERCENT));
+                    pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(200. / nSteps), COL_YELLOW, COLORSCALE_PERCENT));
                     if (nSteps > 3)
-                        pIconSetFormatData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(round(300. / nSteps), COL_WHITE, COLORSCALE_PERCENT));
+                        pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(300. / nSteps), COL_WHITE, COLORSCALE_PERCENT));
                     if (nSteps > 4)
-                        pIconSetFormatData->m_Entries.push_back(std::make_unique<ScColorScaleEntry>(round(400. / nSteps), COL_GREEN, COLORSCALE_PERCENT));
+                        pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(round(400. / nSteps), COL_GREEN, COLORSCALE_PERCENT));
 
                     pEntry->SetIconSetData(pIconSetFormatData);
                     pFormat->AddEntry(pEntry);


More information about the Libreoffice-commits mailing list