diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-14 16:41:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-15 11:02:53 +0200 |
commit | 4c4d9a482b93440fd3388ffa1715e66d1f391fea (patch) | |
tree | dc599ac00d6ca5c3288e4e7053c02c0d62902346 /vcl | |
parent | 256480b8b80769149652bb62f401672ee8fafe1f (diff) |
loplugin:sequentialassign in vcl
Change-Id: I530b81b3258a6e1c1456da53bfe1285f14aee712
Reviewed-on: https://gerrit.libreoffice.org/70734
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
25 files changed, 32 insertions, 73 deletions
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx index 366005a5b198..b06610493073 100644 --- a/vcl/backendtest/VisualBackendTest.cxx +++ b/vcl/backendtest/VisualBackendTest.cxx @@ -545,9 +545,7 @@ protected: try { uno::Reference<uno::XComponentContext> xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext(); - uno::Reference<lang::XMultiServiceFactory> xMSF; - - xMSF = uno::Reference<lang::XMultiServiceFactory>(xComponentContext->getServiceManager(), uno::UNO_QUERY); + uno::Reference<lang::XMultiServiceFactory> xMSF = uno::Reference<lang::XMultiServiceFactory>(xComponentContext->getServiceManager(), uno::UNO_QUERY); if (!xMSF.is()) Application::Abort("Bootstrap failure - no service manager"); diff --git a/vcl/inc/opengl/watchdog.hxx b/vcl/inc/opengl/watchdog.hxx index d37066e80e0c..dc7a16cb8c21 100644 --- a/vcl/inc/opengl/watchdog.hxx +++ b/vcl/inc/opengl/watchdog.hxx @@ -45,8 +45,7 @@ public: WatchdogTimingsValues const & getWatchdogTimingsValues(WatchdogTimingMode eMode) { - size_t index = 0; - index = (eMode == WatchdogTimingMode::SHADER_COMPILE) ? 1 : 0; + size_t index = (eMode == WatchdogTimingMode::SHADER_COMPILE) ? 1 : 0; index = mbRelaxed ? index + 2 : index; return maTimingValues[index]; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index a4302902a3c8..72cb09c30924 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -743,8 +743,7 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI OUString Edit::ImplGetValidString( const OUString& rString ) { - OUString aValidString( rString ); - aValidString = aValidString.replaceAll("\n", "").replaceAll("\r", ""); + OUString aValidString = rString.replaceAll("\n", "").replaceAll("\r", ""); aValidString = aValidString.replace('\t', ' '); return aValidString; } @@ -1033,15 +1032,13 @@ void Edit::ImplPaintBorder(vcl::RenderContext const & rRenderContext) aClipRgn.Move(xNew - aBounds.Left(), 0); // move offset of border window - Point aBorderOffs; - aBorderOffs = pBorder->ScreenToOutputPixel(OutputToScreenPixel(aBorderOffs)); + Point aBorderOffs = pBorder->ScreenToOutputPixel(OutputToScreenPixel(aBorderOffs)); aClipRgn.Move(aBorderOffs.X(), aBorderOffs.Y()); } else { // normal case - Point aBorderOffs; - aBorderOffs = pBorder->ScreenToOutputPixel(OutputToScreenPixel(aBorderOffs)); + Point aBorderOffs = pBorder->ScreenToOutputPixel(OutputToScreenPixel(aBorderOffs)); aClipRgn.Move(aBorderOffs.X(), aBorderOffs.Y()); } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 70b6056c15f4..920c64160b55 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -2145,9 +2145,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r #endif ErrCode nStatus = ERRCODE_NONE; GraphicType eType; - Graphic aGraphic( rGraphic ); - - aGraphic = ImpGetScaledGraphic( rGraphic, aConfigItem ); + Graphic aGraphic = ImpGetScaledGraphic( rGraphic, aConfigItem ); eType = aGraphic.GetType(); if( pConfig->IsExportPixelFormat( nFormat ) ) diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index a86a155ecfe3..1469e87ca7bc 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -745,8 +745,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, { Printer* pThis = dynamic_cast<Printer*>(this); assert(pThis); - Point aPageOffset = pThis->GetPageOffsetPixel(); - aPageOffset = Point( 0, 0 ) - aPageOffset; + Point aPageOffset = Point( 0, 0 ) - pThis->GetPageOffsetPixel(); Size aSize = pThis->GetPaperSizePixel(); aBackgroundComponent.aBounds = tools::Rectangle( aPageOffset, aSize ); } diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 67f82f782195..d879759b5486 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -622,10 +622,8 @@ OUString const & ImplImageTree::getRealImageName(OUString const & rIconName) OUString sNameWithNoExtension = getNameNoExtension(rIconName); - IconLinkHash::iterator it; - // PNG is priority - it = rLinkHash.find(sNameWithNoExtension + ".png"); + auto it = rLinkHash.find(sNameWithNoExtension + ".png"); if (it != rLinkHash.end()) return it->second; diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx index 105c23447229..c0df51f62a67 100644 --- a/vcl/source/outdev/wallpaper.cxx +++ b/vcl/source/outdev/wallpaper.cxx @@ -290,9 +290,8 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY, const Point aTmpPoint; const tools::Rectangle aOutRect( aTmpPoint, GetOutputSizePixel() ); const tools::Rectangle aColRect( Point( nX, nY ), Size( nWidth, nHeight ) ); - tools::Rectangle aWorkRect; - aWorkRect = tools::Rectangle( 0, 0, aOutRect.Right(), aPos.Y() - 1 ); + tools::Rectangle aWorkRect = tools::Rectangle( 0, 0, aOutRect.Right(), aPos.Y() - 1 ); aWorkRect.Justify(); aWorkRect.Intersection( aColRect ); if( !aWorkRect.IsEmpty() ) diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index a9dab867dcbc..0d906416f233 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -2698,8 +2698,7 @@ void SvImpLBox::SetAnchorSelection(SvTreeListEntry* pOldCursor,SvTreeListEntry* if( nNewVisPos < nOldVisPos ) { - pEntry = pNewCursor; - pEntry = pView->NextVisible(pEntry); + pEntry = pView->NextVisible(pNewCursor); while( pEntry && pEntry != pOldCursor ) { pView->Select( pEntry, false ); diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index ec393afa707a..9ebbb7aabfb0 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -3500,8 +3500,7 @@ void SvTreeListBox::ApplySettings(vcl::RenderContext& rRenderContext) void SvTreeListBox::InitSettings() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - vcl::Font aFont; - aFont = rStyleSettings.GetFieldFont(); + vcl::Font aFont = rStyleSettings.GetFieldFont(); aFont.SetColor(rStyleSettings.GetWindowTextColor()); SetPointFont(*this, aFont); AdjustEntryHeightAndRecalc(); diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index d9eef51a59ed..939ed22f237e 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -1079,8 +1079,7 @@ void DecorationView::DrawHandle(const tools::Rectangle& rRect) for (long i = 1; i <= nNumberOfPoints; i++) { - tools::Rectangle aLocation; - aLocation = tools::Rectangle(nHalfWidth - nRadius, + tools::Rectangle aLocation(nHalfWidth - nRadius, round(fDistance * i) - nRadius, nHalfWidth + nRadius, round(fDistance * i) + nRadius); diff --git a/vcl/source/window/dndeventdispatcher.cxx b/vcl/source/window/dndeventdispatcher.cxx index 4f74d092aac3..158019d3ab32 100644 --- a/vcl/source/window/dndeventdispatcher.cxx +++ b/vcl/source/window/dndeventdispatcher.cxx @@ -104,10 +104,8 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) dtde.DropAction, location, dtde.SourceActions, m_aDataFlavorList ); } - sal_Int32 nListeners = 0; - // send drop event to the child window - nListeners = fireDropEvent( pChildWindow, dtde.Context, dtde.DropAction, + sal_Int32 nListeners = fireDropEvent( pChildWindow, dtde.Context, dtde.DropAction, location, dtde.SourceActions, dtde.Transferable ); // reject drop if no listeners found diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index b72b0abea42b..78b43cf8b576 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -592,9 +592,7 @@ Window::PointerState Window::GetPointerState() if (mpWindowImpl->mpFrame) { - SalFrame::SalPointerState aSalPointerState; - - aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); + SalFrame::SalPointerState aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); if( ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index bcbb294e92e4..46b56b330602 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1375,8 +1375,7 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP pDevice->SetTextAlign(GetTextAlign()); pDevice->SetRasterOp(GetRasterOp()); - tools::Rectangle aPaintRect; - aPaintRect = tools::Rectangle(Point(), GetOutputSizePixel()); + tools::Rectangle aPaintRect = tools::Rectangle(Point(), GetOutputSizePixel()); vcl::Region aClipRegion(GetClipRegion()); pDevice->SetClipRegion(); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 2ab9b47a1106..e34633ebc1c4 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -804,10 +804,9 @@ void PrintDialog::storeToSettings() void PrintDialog::readFromSettings() { SettingsConfigItem* pItem = SettingsConfigItem::get(); - OUString aValue; // read last selected tab page; if it exists, activate it - aValue = pItem->getValue( "PrintDialog", + OUString aValue = pItem->getValue( "PrintDialog", "LastPage" ); sal_uInt16 nCount = mpTabCtrl->GetPageCount(); for( sal_uInt16 i = 0; i < nCount; i++ ) diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index cc8941503187..27e0c87cf41f 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -437,9 +437,8 @@ void ImplWindowStateFromStr(WindowStateData& rData, { WindowStateMask nValidMask = WindowStateMask::NONE; sal_Int32 nIndex = 0; - OString aTokenStr; - aTokenStr = rStr.getToken(0, ',', nIndex); + OString aTokenStr = rStr.getToken(0, ',', nIndex); if (!aTokenStr.isEmpty()) { rData.SetX(aTokenStr.toInt32()); diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 3ebcc2650d4a..7461df654a6c 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1040,7 +1040,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, // simulate mouseposition at center of window Size aSize = pChild->GetOutputSize(); - Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); + Point aPos( aSize.getWidth()/2, aSize.getHeight()/2 ); aPos = pChild->OutputToScreenPixel( aPos ); HelpEvent aHelpEvent( aPos, HelpEventMode::BALLOON ); diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 9954988e7af5..0efa066ebd97 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -344,8 +344,7 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) OUString aUDisplay; if( m_xDisplayConnection.is() ) { - Any aIdentifier; - aIdentifier = m_xDisplayConnection->getIdentifier(); + Any aIdentifier = m_xDisplayConnection->getIdentifier(); aIdentifier >>= aUDisplay; } @@ -1888,8 +1887,7 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify // feed incrementals if( rNotify.state == PropertyDelete ) { - std::unordered_map< ::Window, std::unordered_map< Atom, IncrementalTransfer > >::iterator it; - it = m_aIncrementals.find( rNotify.window ); + auto it = m_aIncrementals.find( rNotify.window ); if( it != m_aIncrementals.end() ) { bHandled = true; diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 48a6a767e86b..e99551e00426 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -1586,9 +1586,7 @@ bool X11SalGraphicsImpl::drawFilledTriangles( } // prepare transformation for ObjectToDevice coordinate system - basegfx::B2DHomMatrix aObjectToDevice(rObjectToDevice); - - aObjectToDevice = basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5) * aObjectToDevice; + basegfx::B2DHomMatrix aObjectToDevice = basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5) * rObjectToDevice; // convert the Triangles into XRender-Triangles std::vector<XTriangle> aTriVector(rTriangles.size()); diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx index a92d366ccd1d..b2bde146b3bc 100644 --- a/vcl/unx/generic/print/common_gfx.cxx +++ b/vcl/unx/generic/print/common_gfx.cxx @@ -984,9 +984,7 @@ void PrinterGfx::PSHexString (const unsigned char* pString, sal_Int16 nLen) { OStringBuffer pHexString; - sal_Int32 nChar = 0; - - nChar = psp::appendStr ("<", pHexString); + sal_Int32 nChar = psp::appendStr ("<", pHexString); for (int i = 0; i < nLen; i++) { if (nChar >= (nMaxTextColumn - 1)) diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx index 7cf15556476e..f79e174225bf 100644 --- a/vcl/unx/generic/print/printerjob.cxx +++ b/vcl/unx/generic/print/printerjob.cxx @@ -312,10 +312,8 @@ PrinterJob::StartJob ( "%!PS-Adobe-3.0\n" "%%BoundingBox: (atend)\n" ); - OUString aFilterWS; - // Creator (this application) - aFilterWS = WhitespaceToSpace( rAppName, false ); + OUString aFilterWS = WhitespaceToSpace( rAppName, false ); WritePS (mpJobHeader.get(), "%%Creator: ("); WritePS (mpJobHeader.get(), aFilterWS); WritePS (mpJobHeader.get(), ")\n"); diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index d5b9e7152ffe..d05455e47d14 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -1668,8 +1668,7 @@ const PPDValue* PPDContext::getValue( const PPDKey* pKey ) const if( ! m_pParser ) return nullptr; - hash_type::const_iterator it; - it = m_aCurrentValues.find( pKey ); + hash_type::const_iterator it = m_aCurrentValues.find( pKey ); if( it != m_aCurrentValues.end() ) return it->second; diff --git a/vcl/unx/gtk/a11y/atkcomponent.cxx b/vcl/unx/gtk/a11y/atkcomponent.cxx index f79d1749dc2b..e904b12ac610 100644 --- a/vcl/unx/gtk/a11y/atkcomponent.cxx +++ b/vcl/unx/gtk/a11y/atkcomponent.cxx @@ -141,8 +141,7 @@ component_wrapper_ref_accessible_at_point (AtkComponent *component, if( pComponent.is() ) { - uno::Reference< accessibility::XAccessible > xAccessible; - xAccessible = pComponent->getAccessibleAtPoint( + uno::Reference< accessibility::XAccessible > xAccessible = pComponent->getAccessibleAtPoint( translatePoint( pComponent, x, y, coord_type ) ); return atk_object_wrapper_ref( xAccessible ); } diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx index 737a24b2312e..c30bc638bced 100644 --- a/vcl/unx/gtk/a11y/atklistener.cxx +++ b/vcl/unx/gtk/a11y/atklistener.cxx @@ -435,9 +435,7 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN: { - uno::Reference< accessibility::XAccessibleContext > xParent; - - xParent = getAccessibleContextFromSource(aEvent.Source); + uno::Reference< accessibility::XAccessibleContext > xParent = getAccessibleContextFromSource(aEvent.Source); g_return_if_fail( xParent.is() ); handleInvalidateChildren(xParent); @@ -716,8 +714,7 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven case accessibility::AccessibleEventId::ROLE_CHANGED: { - uno::Reference< accessibility::XAccessibleContext > xContext; - xContext = getAccessibleContextFromSource( aEvent.Source ); + uno::Reference< accessibility::XAccessibleContext > xContext = getAccessibleContextFromSource( aEvent.Source ); atk_object_wrapper_set_role( mpWrapper, xContext->getAccessibleRole() ); break; } diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx index 0ce990426813..759fd14a2a3b 100644 --- a/vcl/unx/gtk/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx @@ -438,8 +438,7 @@ void NWPixmapCacheList::AddCache( NWPixmapCache* pCache ) } void NWPixmapCacheList::RemoveCache( NWPixmapCache* pCache ) { - ::std::vector< NWPixmapCache* >::iterator p; - p = ::std::find( mCaches.begin(), mCaches.end(), pCache ); + auto p = ::std::find( mCaches.begin(), mCaches.end(), pCache ); if( p != mCaches.end() ) mCaches.erase( p ); } @@ -840,11 +839,9 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart, if( aClipRegion.IsNull() ) aClipRegion = aCtrlRect; - tools::Rectangle aPixmapRect; - // make pixmap a little larger since some themes draw decoration // outside the rectangle, see e.g. checkbox - aPixmapRect = tools::Rectangle(Point( aCtrlRect.Left()-1, aCtrlRect.Top()-1 ), + tools::Rectangle aPixmapRect(Point( aCtrlRect.Left()-1, aCtrlRect.Top()-1 ), Size( aCtrlRect.GetWidth()+2, aCtrlRect.GetHeight()+2) ); ControlCacheKey aControlCacheKey(nType, nPart, nState, aPixmapRect.GetSize()); @@ -1131,10 +1128,8 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, NWEnsureGTKMenubar( m_nXScreen ); GtkRequisition aReq; gtk_widget_size_request( gWidgetData[m_nXScreen].gMenubarWidget, &aReq ); - tools::Rectangle aMenuBarRect = rControlRegion; - aMenuBarRect = tools::Rectangle( aMenuBarRect.TopLeft(), - Size( aMenuBarRect.GetWidth(), aReq.height+1 ) ); - rNativeBoundingRegion = aMenuBarRect; + rNativeBoundingRegion = tools::Rectangle( rControlRegion.TopLeft(), + Size( rControlRegion.GetWidth(), aReq.height+1 ) ); rNativeContentRegion = rNativeBoundingRegion; returnVal = true; } diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index eb2fa77e3240..1b78996642e7 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -208,8 +208,7 @@ OString MyWin::processCommand( const OString& rCommand ) else { ssize_t nBytes = 0; - ssize_t fd = 0; - fd = write( nSocket, rCommand.getStr(), rCommand.getLength() ); + ssize_t fd = write( nSocket, rCommand.getStr(), rCommand.getLength() ); if (fd == 0) SAL_WARN("vcl", "Connection closed on other end"); |