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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 1 10:11:43 UTC 2021


 sc/source/filter/xcl97/xcl97rec.cxx |    2 +-
 sc/source/filter/xml/xmlbodyi.cxx   |    8 ++++----
 sc/source/filter/xml/xmlimprt.cxx   |   30 +++++++++++++++---------------
 3 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 9e37f53874d4e36e3529345ffe7a5721e6a4c751
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jun 1 10:43:08 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jun 1 12:11:00 2021 +0200

    no need to allocate these on the heap
    
    Change-Id: I3ff875f8cf6f8b32bdf1c8b066f5f80dbff4aa64
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116521
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index de7a3762ac8b..4cde52e362f1 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -454,7 +454,7 @@ void XclObj::WriteBody( XclExpStream& rStrm )
 
     // create a substream to be able to create subrecords
     SvMemoryStream aMemStrm;
-    std::unique_ptr< XclExpStream > pXclStrm( new XclExpStream( aMemStrm, rStrm.GetRoot() ) );
+    std::optional< XclExpStream > pXclStrm( std::in_place, aMemStrm, rStrm.GetRoot() );
 
     // write the ftCmo subrecord
     pXclStrm->StartRecord( EXC_ID_OBJCMO, 18 );
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index cd82d73aba5a..4791d8bd4d7c 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -257,17 +257,17 @@ void SAL_CALL ScXMLBodyContext::endFastElement(sal_Int32 nElement)
     if (!bProtected)
         return;
 
-    std::unique_ptr<ScDocProtection> pProtection(new ScDocProtection);
-    pProtection->setProtected(true);
+    ScDocProtection aProtection;
+    aProtection.setProtected(true);
 
     uno::Sequence<sal_Int8> aPass;
     if (!sPassword.isEmpty())
     {
         ::comphelper::Base64::decode(aPass, sPassword);
-        pProtection->setPasswordHash(aPass, meHash1, meHash2);
+        aProtection.setPasswordHash(aPass, meHash1, meHash2);
     }
 
-    pDoc->SetDocProtection(pProtection.get());
+    pDoc->SetDocProtection(&aProtection);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index f8ff9bdde955..938f0c79d403 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -636,29 +636,29 @@ void ScXMLImport::SetChangeTrackingViewSettings(const css::uno::Sequence<css::be
 
     ScXMLImport::MutexGuard aGuard(*this);
     sal_Int16 nTemp16(0);
-    std::unique_ptr<ScChangeViewSettings> pViewSettings(new ScChangeViewSettings());
+    ScChangeViewSettings aViewSettings;
     for (const auto& rChangeProp : rChangeProps)
     {
         OUString sName(rChangeProp.Name);
         if (sName == "ShowChanges")
-            pViewSettings->SetShowChanges(::cppu::any2bool(rChangeProp.Value));
+            aViewSettings.SetShowChanges(::cppu::any2bool(rChangeProp.Value));
         else if (sName == "ShowAcceptedChanges")
-            pViewSettings->SetShowAccepted(::cppu::any2bool(rChangeProp.Value));
+            aViewSettings.SetShowAccepted(::cppu::any2bool(rChangeProp.Value));
         else if (sName == "ShowRejectedChanges")
-            pViewSettings->SetShowRejected(::cppu::any2bool(rChangeProp.Value));
+            aViewSettings.SetShowRejected(::cppu::any2bool(rChangeProp.Value));
         else if (sName == "ShowChangesByDatetime")
-            pViewSettings->SetHasDate(::cppu::any2bool(rChangeProp.Value));
+            aViewSettings.SetHasDate(::cppu::any2bool(rChangeProp.Value));
         else if (sName == "ShowChangesByDatetimeMode")
         {
             if (rChangeProp.Value >>= nTemp16)
-                pViewSettings->SetTheDateMode(static_cast<SvxRedlinDateMode>(nTemp16));
+                aViewSettings.SetTheDateMode(static_cast<SvxRedlinDateMode>(nTemp16));
         }
         else if (sName == "ShowChangesByDatetimeFirstDatetime")
         {
             util::DateTime aDateTime;
             if (rChangeProp.Value >>= aDateTime)
             {
-                pViewSettings->SetTheFirstDateTime(::DateTime(aDateTime));
+                aViewSettings.SetTheFirstDateTime(::DateTime(aDateTime));
             }
         }
         else if (sName == "ShowChangesByDatetimeSecondDatetime")
@@ -666,31 +666,31 @@ void ScXMLImport::SetChangeTrackingViewSettings(const css::uno::Sequence<css::be
             util::DateTime aDateTime;
             if (rChangeProp.Value >>= aDateTime)
             {
-                pViewSettings->SetTheLastDateTime(::DateTime(aDateTime));
+                aViewSettings.SetTheLastDateTime(::DateTime(aDateTime));
             }
         }
         else if (sName == "ShowChangesByAuthor")
-            pViewSettings->SetHasAuthor(::cppu::any2bool(rChangeProp.Value));
+            aViewSettings.SetHasAuthor(::cppu::any2bool(rChangeProp.Value));
         else if (sName == "ShowChangesByAuthorName")
         {
             OUString sOUName;
             if (rChangeProp.Value >>= sOUName)
             {
-                pViewSettings->SetTheAuthorToShow(sOUName);
+                aViewSettings.SetTheAuthorToShow(sOUName);
             }
         }
         else if (sName == "ShowChangesByComment")
-            pViewSettings->SetHasComment(::cppu::any2bool(rChangeProp.Value));
+            aViewSettings.SetHasComment(::cppu::any2bool(rChangeProp.Value));
         else if (sName == "ShowChangesByCommentText")
         {
             OUString sOUComment;
             if (rChangeProp.Value >>= sOUComment)
             {
-                pViewSettings->SetTheComment(sOUComment);
+                aViewSettings.SetTheComment(sOUComment);
             }
         }
         else if (sName == "ShowChangesByRanges")
-            pViewSettings->SetHasRange(::cppu::any2bool(rChangeProp.Value));
+            aViewSettings.SetHasRange(::cppu::any2bool(rChangeProp.Value));
         else if (sName == "ShowChangesByRangesList")
         {
             OUString sRanges;
@@ -699,11 +699,11 @@ void ScXMLImport::SetChangeTrackingViewSettings(const css::uno::Sequence<css::be
                 ScRangeList aRangeList;
                 ScRangeStringConverter::GetRangeListFromString(
                     aRangeList, sRanges, *pDoc, FormulaGrammar::CONV_OOO);
-                pViewSettings->SetTheRangeList(aRangeList);
+                aViewSettings.SetTheRangeList(aRangeList);
             }
         }
     }
-    pDoc->SetChangeViewSettings(*pViewSettings);
+    pDoc->SetChangeViewSettings(aViewSettings);
 }
 
 void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aViewProps)


More information about the Libreoffice-commits mailing list