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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 29 16:33:26 UTC 2021


 sw/source/filter/writer/writer.cxx |   21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 85141c9175af90511e3cb5c134dfbbc63961cd39
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 29 11:13:28 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 29 18:32:53 2021 +0200

    no need for this map to be optional
    
    an empty map is a very small object
    
    Change-Id: I9153c3dfbbdb8f6781cbba2c8067d4cac5372578
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119667
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 88538e6c46e0..f775293554d9 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -65,7 +65,7 @@ struct Writer_Impl
 {
     SvStream * m_pStream;
 
-    std::optional< std::map<OUString, OUString> > xFileNameMap;
+    std::map<OUString, OUString> maFileNameMap;
     std::vector<const SvxFontItem*> aFontRemoveLst;
     SwBookmarkNodeTable aBkmkNodePos;
 
@@ -312,19 +312,12 @@ bool Writer::CopyLocalFileToINet( OUString& rFileNm )
             INetProtocol::VndSunStarWebdav >= aTargetUrl.GetProtocol() ) )
         return bRet;
 
-    if (m_pImpl->xFileNameMap)
+    // has the file been moved?
+    std::map<OUString, OUString>::iterator it = m_pImpl->maFileNameMap.find( rFileNm );
+    if ( it != m_pImpl->maFileNameMap.end() )
     {
-        // has the file been moved?
-        std::map<OUString, OUString>::iterator it = m_pImpl->xFileNameMap->find( rFileNm );
-        if ( it != m_pImpl->xFileNameMap->end() )
-        {
-            rFileNm = it->second;
-            return true;
-        }
-    }
-    else
-    {
-        m_pImpl->xFileNameMap.emplace();
+        rFileNm = it->second;
+        return true;
     }
 
     OUString aSrc  = rFileNm;
@@ -342,7 +335,7 @@ bool Writer::CopyLocalFileToINet( OUString& rFileNm )
 
     if( bRet )
     {
-        m_pImpl->xFileNameMap->insert( std::make_pair( aSrc, aDest ) );
+        m_pImpl->maFileNameMap.insert( std::make_pair( aSrc, aDest ) );
         rFileNm = aDest;
     }
 


More information about the Libreoffice-commits mailing list