[Libreoffice-commits] core.git: editeng/source extensions/source filter/source forms/source fpicker/source framework/source helpcompiler/source i18npool/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 23 09:48:46 UTC 2018


 editeng/source/items/paperinf.cxx                   |    2 +-
 editeng/source/misc/acorrcfg.cxx                    |    3 ++-
 editeng/source/outliner/outliner.cxx                |    2 +-
 extensions/source/bibliography/bibload.cxx          |    2 +-
 filter/source/flash/swfwriter1.cxx                  |    4 ++--
 filter/source/graphicfilter/eps/eps.cxx             |    6 +++---
 filter/source/graphicfilter/etiff/etiff.cxx         |    2 +-
 filter/source/graphicfilter/icgm/actimpr.cxx        |    2 +-
 filter/source/msfilter/escherex.cxx                 |    2 +-
 filter/source/msfilter/msvbahelper.cxx              |    2 +-
 filter/source/svg/svgwriter.cxx                     |    2 +-
 filter/source/xsltfilter/LibXSLTTransformer.cxx     |   12 +++---------
 forms/source/richtext/richtextengine.cxx            |    2 +-
 fpicker/source/office/iodlg.cxx                     |    2 +-
 framework/source/fwe/helper/actiontriggerhelper.cxx |    2 +-
 framework/source/fwi/helper/mischelper.cxx          |    2 +-
 framework/source/tabwin/tabwindow.cxx               |    4 ++--
 helpcompiler/source/HelpCompiler.cxx                |    3 +--
 i18npool/source/localedata/LocaleNode.cxx           |   12 ++++++------
 19 files changed, 31 insertions(+), 37 deletions(-)

New commits:
commit 51d1ec7883444e6216f1020122084d3a996c9ecb
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 23 07:50:57 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Oct 23 11:48:22 2018 +0200

    clang-tidy performance-unnecessary-copy-init in editeng..i18npool
    
    Change-Id: I2ee2c8d15d8700cfaa1697363da4557c741a5f36
    Reviewed-on: https://gerrit.libreoffice.org/62216
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/items/paperinf.cxx b/editeng/source/items/paperinf.cxx
index 546c1e9c1d68..07ab725f1591 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -65,7 +65,7 @@ Size SvxPaperInfo::GetPaperSize( const Printer* pPrinter )
 
         if ( aPaperSize == aInvalidSize )
             return GetPaperSize(PAPER_A4);
-        MapMode aMap1 = pPrinter->GetMapMode();
+        const MapMode& aMap1 = pPrinter->GetMapMode();
         MapMode aMap2;
 
         if ( aMap1 == aMap2 )
diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index e2c45e1850b0..c2b3dbe6fe31 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -48,7 +48,8 @@ SvxAutoCorrCfg::SvxAutoCorrCfg() :
     bSearchInAllCategories(false)
 {
     SvtPathOptions aPathOpt;
-    OUString sSharePath, sUserPath, sAutoPath( aPathOpt.GetAutoCorrectPath() );
+    OUString sSharePath, sUserPath;
+    OUString const & sAutoPath( aPathOpt.GetAutoCorrectPath() );
 
     sSharePath = sAutoPath.getToken(0, ';');
     sUserPath = sAutoPath.getToken(1, ';');
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index da008ce69989..51e0a5f96383 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -969,7 +969,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
 
                 if(bStrippingPortions)
                 {
-                    const vcl::Font aSvxFont(pOutDev->GetFont());
+                    const vcl::Font& aSvxFont(pOutDev->GetFont());
                     std::unique_ptr<long[]> pBuf(new long[ pPara->GetText().getLength() ]);
                     pOutDev->GetTextArray( pPara->GetText(), pBuf.get() );
 
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index 76d4ed6fc43e..06c77c01d902 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -471,7 +471,7 @@ Any BibliographyLoader::getByName(const OUString& rName)
                     const Mapping* pMapping = pConfig->GetMapping(aBibDesc);
                     for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
                     {
-                        const OUString sColName = pConfig->GetDefColumnName(
+                        const OUString& sColName = pConfig->GetDefColumnName(
                                                     nEntry);
                         pValues[nEntry].Name = sColName;
                         pValues[nEntry].Value <<= lcl_AddProperty(xColumns, pMapping, sColName);
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index f32eb9538f53..436c2783d63a 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -1250,7 +1250,7 @@ void Writer::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegf
         {
             for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
             {
-                const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
+                const basegfx::B2DPolygon& aCandidate(aLinePolyPolygon.getB2DPolygon(a));
                 Impl_writePolygon( tools::Polygon(aCandidate), false );
             }
         }
@@ -1500,7 +1500,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
             case MetaActionType::EPS:
             {
                 const MetaEPSAction*    pA = static_cast<const MetaEPSAction*>(pAction);
-                const GDIMetaFile       aGDIMetaFile( pA->GetSubstitute() );
+                const GDIMetaFile&      aGDIMetaFile( pA->GetSubstitute() );
                 bool                bFound = false;
 
                 for( size_t j = 0, nC = aGDIMetaFile.GetActionSize(); ( j < nC ) && !bFound; j++ )
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 28e0f59b40b2..e131091b9ba1 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -898,7 +898,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
             {
                 const MetaWallpaperAction* pA = static_cast<const MetaWallpaperAction*>(pMA);
                 tools::Rectangle   aRect = pA->GetRect();
-                Wallpaper   aWallpaper = pA->GetWallpaper();
+                const Wallpaper&   aWallpaper = pA->GetWallpaper();
 
                 if ( aWallpaper.IsBitmap() )
                 {
@@ -946,7 +946,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
             case MetaActionType::CLIPREGION:
             {
                 const MetaClipRegionAction* pA = static_cast<const MetaClipRegionAction*>(pMA);
-                vcl::Region aRegion( pA->GetRegion() );
+                const vcl::Region& aRegion( pA->GetRegion() );
                 ImplSetClipRegion( aRegion );
             }
             break;
@@ -954,7 +954,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
             case MetaActionType::ISECTREGIONCLIPREGION:
             {
                 const MetaISectRegionClipRegionAction* pA = static_cast<const MetaISectRegionClipRegionAction*>(pMA);
-                vcl::Region aRegion( pA->GetRegion() );
+                const vcl::Region& aRegion( pA->GetRegion() );
                 ImplSetClipRegion( aRegion );
             }
             break;
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
index dc3349f82791..2c95f2c5712d 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -189,7 +189,7 @@ bool TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem const * pF
                 if ( ImplWriteHeader( aAnimation.Count() > 0 ) )
                 {
                     Size aDestMapSize( 300, 300 );
-                    const MapMode aMapMode( aBmp.GetPrefMapMode() );
+                    const MapMode& aMapMode( aBmp.GetPrefMapMode() );
                     if ( aMapMode.GetMapUnit() != MapUnit::MapPixel )
                     {
                         const Size aPrefSize( rGraphic.GetPrefSize() );
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
index daa20e40d57f..4d09031925ef 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -684,7 +684,7 @@ void CGMImpressOutAct::DrawPolyPolygon( tools::PolyPolygon const & rPolyPolygon
 
         for( sal_uInt32 a = 0; a < nNumPolys; a++ )
         {
-            tools::Polygon aPolygon( rPolyPolygon.GetObject( a ) );
+            const tools::Polygon& aPolygon( rPolyPolygon.GetObject( a ) );
             sal_uInt32 nNumPoints = aPolygon.GetSize();
 
             // make room in arrays
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 309975c92c16..953d4c423f9c 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -587,7 +587,7 @@ void    EscherPropertyContainer::CreateFillProperties(
         SdrObject* pObj = GetSdrObjectFromXShape( rXShape );
         if ( pObj )
         {
-            SfxItemSet aAttr( pObj->GetMergedItemSet() );
+            const SfxItemSet& aAttr( pObj->GetMergedItemSet() );
             // tranparency with gradient. Means the third setting in transparency page is set
             bool bTransparentGradient =  ( aAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SfxItemState::SET ) &&
                 aAttr.Get( XATTR_FILLFLOATTRANSPARENCE ).IsEnabled();
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 33ec4e3ce63a..90c23a0797b3 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -315,7 +315,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro
         if( bSearchGlobalTemplates )
         {
             SvtPathOptions aPathOpt;
-            OUString aAddinPath = aPathOpt.GetAddinPath();
+            const OUString& aAddinPath = aPathOpt.GetAddinPath();
             if( sDocUrlOrPath.startsWith( aAddinPath ) )
                 pFoundShell = pShell;
         }
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index eff3d607fa77..9565383dbb5d 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3025,7 +3025,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                 if( nWriteFlags & SVGWRITER_WRITE_FILL )
                 {
                     const MetaEPSAction*    pA = static_cast<const MetaEPSAction*>(pAction);
-                    const GDIMetaFile       aGDIMetaFile( pA->GetSubstitute() );
+                    const GDIMetaFile&      aGDIMetaFile( pA->GetSubstitute() );
                     bool                bFound = false;
 
                     for( sal_uInt32 k = 0, nCount2 = aGDIMetaFile.GetActionSize(); ( k < nCount2 ) && !bFound; ++k )
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index b27546e1343f..acc81d4e1196 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -421,10 +421,8 @@ namespace XSLT
     void
     LibXSLTTransformer::start()
     {
-        ListenerList* l = &m_listeners;
-        for (auto const& elem : *l)
+        for (const css::uno::Reference<XStreamListener>& xl : m_listeners)
         {
-            css::uno::Reference<XStreamListener> xl = elem;
             xl.get()->started();
         }
         OSL_ENSURE(!m_Reader.is(), "Somebody forgot to call terminate *and* holds a reference to this LibXSLTTransformer instance");
@@ -435,12 +433,10 @@ namespace XSLT
     void
     LibXSLTTransformer::error(const OUString& msg)
     {
-        ListenerList* l = &m_listeners;
         Any arg;
         arg <<= Exception(msg, *this);
-        for (auto const& elem : *l)
+        for (const css::uno::Reference<XStreamListener>& xl : m_listeners)
         {
-            css::uno::Reference<XStreamListener> xl = elem;
             if (xl.is())
             {
                 xl.get()->error(arg);
@@ -451,10 +447,8 @@ namespace XSLT
     void
     LibXSLTTransformer::done()
     {
-        ListenerList* l = &m_listeners;
-        for (auto const& elem : *l)
+        for (const css::uno::Reference<XStreamListener>& xl : m_listeners)
         {
-            css::uno::Reference<XStreamListener> xl = elem;
             if (xl.is())
             {
                 xl.get()->closed();
diff --git a/forms/source/richtext/richtextengine.cxx b/forms/source/richtext/richtextengine.cxx
index 481c80ba4e91..13070c6d0094 100644
--- a/forms/source/richtext/richtextengine.cxx
+++ b/forms/source/richtext/richtextengine.cxx
@@ -49,7 +49,7 @@ namespace frm
 
         RichTextEngine* pReturn = new RichTextEngine( pPool );
         OutputDevice* pOutputDevice = pReturn->GetRefDevice();
-        MapMode aDeviceMapMode( pOutputDevice->GetMapMode() );
+        const MapMode& aDeviceMapMode( pOutputDevice->GetMapMode() );
 
         pReturn->SetStatusEventHdl( LINK( pReturn, RichTextEngine, EditEngineStatusChanged ) );
 
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 04d57289ede5..18714773cdf3 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -1492,7 +1492,7 @@ IMPL_LINK_NOARG(SvtFileDialog, EntrySelectHdl_Impl, ComboBox&, void)
 
 IMPL_LINK( SvtFileDialog, OpenDoneHdl_Impl, SvtFileView*, pView, void )
 {
-    OUString sCurrentFolder( pView->GetViewURL() );
+    const OUString& sCurrentFolder( pView->GetViewURL() );
     // check if we can create new folders
     EnableControl( pImpl->_pBtnNewFolder, ContentCanMakeFolder( sCurrentFolder ) );
 
diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx
index 8d00b23a9e6e..0a9bc906c5be 100644
--- a/framework/source/fwe/helper/actiontriggerhelper.cxx
+++ b/framework/source/fwe/helper/actiontriggerhelper.cxx
@@ -159,7 +159,7 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer
                                     {
                                         // This is our own optimized implementation of menu images!
                                         ImageWrapper* pImageWrapper = reinterpret_cast< ImageWrapper * >( nPointer );
-                                        Image aMenuImage = pImageWrapper->GetImage();
+                                        const Image& aMenuImage = pImageWrapper->GetImage();
 
                                         if ( !!aMenuImage )
                                             pSubMenu->SetItemImage( nNewItemId, aMenuImage );
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index fa94988a7e35..c991a8cc0774 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -89,7 +89,7 @@ void FillLangItems( std::set< OUString > &rLangItems,
     }
 
     //4--guessed language
-    uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( rLangGuessHelper.GetGuesser() );
+    const uno::Reference< linguistic2::XLanguageGuessing >& xLangGuesser( rLangGuessHelper.GetGuesser() );
     if ( xLangGuesser.is() && !rGuessedTextLang.isEmpty())
     {
         css::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( rGuessedTextLang, 0, rGuessedTextLang.getLength()) );
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index 606f13748517..06b938db0410 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -233,7 +233,7 @@ IMPL_LINK( TabWindow, Activate, TabControl*, pTabControl, void )
 
     sal_Int32 nPageId = pTabControl->GetCurPageId();
 
-    OUString aTitle = pTabControl->GetPageText( sal_uInt16( nPageId ));
+    const OUString& aTitle = pTabControl->GetPageText( sal_uInt16( nPageId ));
     impl_SetTitle( aTitle );
     aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -664,7 +664,7 @@ css::uno::Sequence< css::beans::NamedValue > SAL_CALL TabWindow::getTabProps( ::
         if ( nPos == TAB_PAGE_NOTFOUND )
             throw css::lang::IndexOutOfBoundsException();
 
-        OUString aTitle = pTabControl->GetPageText( sal_uInt16( ID ));
+        const OUString& aTitle = pTabControl->GetPageText( sal_uInt16( ID ));
                   nPos   = pTabControl->GetPagePos( sal_uInt16( ID ));
 
         css::uno::Sequence< css::beans::NamedValue > aSeq
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index d7ce8cfcc5d9..9050c5f983a1 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -427,9 +427,8 @@ void myparser::traverse( xmlNodePtr parentNode )
                 //TODO: make these asserts and flush out all our broken help ids
                 SAL_WARN_IF(hidstr.empty(), "helpcompiler", "hid='' for text:" << text);
                 SAL_WARN_IF(!hidstr.empty() && extendedHelpText.empty(), "helpcompiler", "hid='.' with no hid bookmark branches in file: " << fileName + " for text: " << text);
-                for (auto const& elem : extendedHelpText)
+                for (const std::string& name : extendedHelpText)
                 {
-                    std::string name = elem;
                     (*helptexts)[name] = text;
                 }
             }
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index ff384c394fcc..11d3f4bb070c 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -255,7 +255,7 @@ void LCInfoNode::generateCode (const OFileWriter &of) const
     if (variantNode)
     {
         // If given Variant must be at least ll-Ssss and language must be 'qlt'
-        OUString aVariant( variantNode->getValue());
+        const OUString& aVariant( variantNode->getValue());
         if (!(aVariant.isEmpty() || (aVariant.getLength() >= 7 && aVariant.indexOf('-') >= 2)))
             incErrorStr( "Error: invalid Variant '%s'\n", aVariant);
         if (!(aVariant.isEmpty() || aLanguage == "qlt"))
@@ -693,7 +693,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
                         if (sTheCompatibleCurrency.isEmpty() &&
                                 ((nStart = n->getValue().indexOf("[$")) >= 0))
                         {
-                            OUString aCode( n->getValue());
+                            const OUString& aCode( n->getValue());
                             sal_Int32 nHyphen = aCode.indexOf( '-', nStart);
                             if (nHyphen >= nStart + 3)
                                 sTheCompatibleCurrency = aCode.copy( nStart + 2, nHyphen - nStart - 2);
@@ -709,7 +709,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
                     // and not parenthesized [C]###0;([C]###0) if not en_US.
                     if (strcmp( of.getLocale(), "en_US") != 0)
                     {
-                        OUString aCode( n->getValue());
+                        const OUString& aCode( n->getValue());
                         OUString const aPar1( "0)");
                         OUString const aPar2( "-)" );
                         OUString const aPar3( " )" );
@@ -721,7 +721,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
                     // Check if we have replaceTo for "[CURRENCY]" placeholder.
                     if (sTheCurrencyReplaceTo.isEmpty())
                     {
-                        OUString aCode( n->getValue());
+                        const OUString& aCode( n->getValue());
                         if (aCode.indexOf( "[CURRENCY]" ) >= 0)
                             incErrorInt( "Error: [CURRENCY] replaceTo not found for formatindex=\"%d\".\n", formatindex);
                     }
@@ -730,7 +730,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
                     if (aUsage == "SCIENTIFIC_NUMBER")
                     {
                         // Check for presence of  ##0.00E+00
-                        OUString aCode( n->getValue());
+                        const OUString& aCode( n->getValue());
                         // Simple check without decimal separator (assumed to
                         // be one UTF-16 character). May be prefixed with
                         // [NatNum1] or other tags.
@@ -744,7 +744,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
             if (pCtype)
             {
                 int nSavErr = nError;
-                OUString aCode( n->getValue());
+                const OUString& aCode( n->getValue());
                 if (formatindex == cssi::NumberFormatIndex::NUMBER_1000DEC2)
                 {
                     sal_Int32 nDec = -1;


More information about the Libreoffice-commits mailing list