summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-28 12:03:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-29 08:53:23 +0200
commit0d36b32755ac662299e6a8165e9fa57311b74a2f (patch)
treece68c6d050056858dbf31033d7d3a3741aab2276
parentf53fcf9cfcc0bef415f9d2d95132ccd8bbe96061 (diff)
loplugin:sequentialassign
Change-Id: I56a9bf698b60bd278c71cc632aacef2bd2f4c13f Reviewed-on: https://gerrit.libreoffice.org/76501 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx3
-rw-r--r--cui/source/customize/CustomNotebookbarGenerator.cxx3
-rw-r--r--cui/source/dialogs/tipofthedaydlg.cxx3
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx3
-rw-r--r--include/svx/sdasitm.hxx5
-rw-r--r--include/xmloff/nmspmap.hxx5
-rw-r--r--jvmfwk/source/fwkbase.cxx3
-rw-r--r--lingucomponent/source/thesaurus/libnth/nthesimp.cxx8
-rw-r--r--sc/inc/externalrefmgr.hxx3
-rw-r--r--sd/source/ui/dlg/PhotoAlbumDialog.cxx4
-rw-r--r--sw/source/core/access/acchyperlink.cxx3
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx3
-rw-r--r--sw/source/uibase/shells/basesh.cxx3
-rw-r--r--test/source/table/tablecolumn.cxx4
-rw-r--r--writerfilter/source/dmapper/SdtHelper.cxx3
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_import.cxx3
-rw-r--r--xmlscript/source/xmlflat_imexp/xmlbas_export.cxx12
-rw-r--r--xmlscript/source/xmllib_imexp/xmllib_export.cxx6
18 files changed, 25 insertions, 52 deletions
diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
index e7727cc5f2ce..43a9d87df927 100644
--- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
+++ b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx
@@ -107,8 +107,7 @@ namespace cppu_ifcontainer
pContainer->addInterface(xRef);
aListeners.push_back(xRef);
}
- Sequence< Reference< XInterface > > aElements;
- aElements = pContainer->getElements();
+ Sequence< Reference< XInterface > > aElements = pContainer->getElements();
CPPUNIT_ASSERT_MESSAGE("query contents",
bool(static_cast<int>(aElements.getLength()) == nTests));
diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx
index ceb5bd30fa64..b8f7e7c6fd49 100644
--- a/cui/source/customize/CustomNotebookbarGenerator.cxx
+++ b/cui/source/customize/CustomNotebookbarGenerator.cxx
@@ -130,8 +130,7 @@ static OUString getUIDirPath()
char* CustomNotebookbarGenerator::convertToCharPointer(const OUString& sString)
{
- char* cString = nullptr;
- cString = new char[sString.getLength() + 1];
+ char* cString = new char[sString.getLength() + 1];
for (int nIdx = 0; nIdx < sString.getLength(); nIdx++)
*(cString + nIdx) = char(sString[nIdx]);
*(cString + sString.getLength()) = '\0';
diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx
index 1495d83f163b..df52c5cc0106 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -103,8 +103,7 @@ void TipOfTheDayDialog::UpdateTip()
Graphic aGraphic;
if (GraphicFilter::LoadGraphic(aURL + aImage, OUString(), aGraphic) == ERRCODE_NONE)
{
- ScopedVclPtr<VirtualDevice> m_pVirDev;
- m_pVirDev = m_pImage->create_virtual_device();
+ ScopedVclPtr<VirtualDevice> m_pVirDev = m_pImage->create_virtual_device();
m_pVirDev->SetOutputSizePixel(aGraphic.GetSizePixel());
m_pVirDev->DrawBitmapEx(Point(0, 0), aGraphic.GetBitmapEx());
m_pImage->set_image(m_pVirDev.get());
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index f8e244a0d148..d0bbafde032c 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -2261,10 +2261,9 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre
DockingArea = ui::DockingArea_DOCKINGAREA_TOP;
uno::Reference< awt::XWindow > xDockingWindow( m_xDockAreaWindows[static_cast<int>(DockingArea)] );
::Size aDockingWinSize;
- vcl::Window* pDockingWindow( nullptr );
// Retrieve output size from container Window
- pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ).get();
+ vcl::Window* pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ).get();
if ( pDockingWindow )
aDockingWinSize = pDockingWindow->GetOutputSizePixel();
aReadLock.clear();
diff --git a/include/svx/sdasitm.hxx b/include/svx/sdasitm.hxx
index e0aeaddab83a..84431a4969c0 100644
--- a/include/svx/sdasitm.hxx
+++ b/include/svx/sdasitm.hxx
@@ -88,10 +88,7 @@ inline SdrOnOffItem makeSdrTextWordWrapItem( bool bAuto ) {
inline size_t SdrCustomShapeGeometryItem::PropertyPairHash::operator()( const SdrCustomShapeGeometryItem::PropertyPair &r1 ) const
{
- size_t hash = 17;
- hash = hash * 37 + r1.first.hashCode();
- hash = hash * 37 + r1.second.hashCode();
- return hash;
+ return r1.first.hashCode() * 37 + r1.second.hashCode();
};
#endif
diff --git a/include/xmloff/nmspmap.hxx b/include/xmloff/nmspmap.hxx
index 234b5e4dda2a..e6875b1c8a39 100644
--- a/include/xmloff/nmspmap.hxx
+++ b/include/xmloff/nmspmap.hxx
@@ -55,10 +55,7 @@ struct QNamePairHash
{
size_t operator()( const QNamePair &r1 ) const
{
- size_t hash = 17;
- hash = hash * 37 + r1.first;
- hash = hash * 37 + r1.second.hashCode();
- return hash;
+ return r1.first * 37 + r1.second.hashCode();
}
};
diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx
index 1d0657a5a051..221e2bef9766 100644
--- a/jvmfwk/source/fwkbase.cxx
+++ b/jvmfwk/source/fwkbase.cxx
@@ -117,8 +117,7 @@ boost::optional<VersionInfo> VendorSettings::getVersionInformation(const OUStrin
{
OSL_ASSERT(!sVendor.isEmpty());
OString osVendor = OUStringToOString(sVendor, RTL_TEXTENCODING_UTF8);
- CXPathObjectPtr pathObject;
- pathObject = xmlXPathEvalExpression(
+ CXPathObjectPtr pathObject = xmlXPathEvalExpression(
reinterpret_cast<xmlChar const *>(
OString(
"/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"" + osVendor
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 7852a7985f7b..da2d19a8fde6 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -375,9 +375,8 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
// generate synonyms with affixes
if (stem && stem2)
{
- Reference< XSpellAlternatives > xTmpRes;
- xTmpRes = xSpell->spell( "<?xml?><query type='generate'><word>" +
- sTerm + "</word>" + codeTerm + "</query>", static_cast<sal_uInt16>(nLanguage), rProperties );
+ Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "<?xml?><query type='generate'><word>" +
+ sTerm + "</word>" + codeTerm + "</query>", static_cast<sal_uInt16>(nLanguage), rProperties );
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();
@@ -431,8 +430,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
if (!xSpell.is() || !xSpell->isValid( SPELLML_SUPPORT, static_cast<sal_uInt16>(nLanguage), rProperties ))
return noMeanings;
- Reference< XSpellAlternatives > xTmpRes;
- xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
+ Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
aRTerm + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
if (xTmpRes.is())
{
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 7bd670f7cddd..ae6a7f8ab80b 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -305,8 +305,7 @@ private:
{
const ScAddress& s = rRange.aStart;
const ScAddress& e = rRange.aEnd;
- size_t hash = 17;
- hash = hash * 37 + s.Tab();
+ size_t hash = s.Tab();
hash = hash * 37 + s.Col();
hash = hash * 37 + s.Row();
hash = hash * 37 + e.Tab();
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 914674c31700..c8234b9304b8 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -666,8 +666,8 @@ Reference< drawing::XDrawPage > SdPhotoAlbumDialog::appendNewSlide(AutoLayout aL
const Reference< drawing::XDrawPages >& xDrawPages
)
{
- Reference< drawing::XDrawPage > xSlide; // Create the slide
- xSlide = xDrawPages->insertNewByIndex( xDrawPages->getCount() );
+ // Create the slide
+ Reference< drawing::XDrawPage > xSlide = xDrawPages->insertNewByIndex( xDrawPages->getCount() );
SdPage* pSlide = m_pDoc->GetSdPage( m_pDoc->GetSdPageCount(PageKind::Standard)-1, PageKind::Standard);
pSlide->SetAutoLayout(aLayout, true); // Set the layout here
return xSlide;
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index e7d756af731c..fbade55b8569 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -214,8 +214,7 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::isValid( )
for( const OUString& aLink : aNames )
{
- uno::Any aAny;
- aAny = xLinks->getByName( aLink );
+ uno::Any aAny = xLinks->getByName( aLink );
aAny >>= xSubLinks;
if (xSubLinks->hasByName(sText.copy(1)) )
return true;
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 6331035d7a01..fb696970c763 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1558,8 +1558,7 @@ css::uno::Reference<css::datatransfer::dnd::XDropTarget> AddressMultiLineEdit::G
bool AddressMultiLineEdit::SetCursorLogicPosition(const Point& rPosition)
{
- Point aMousePos(rPosition);
- aMousePos = EditViewOutputDevice().PixelToLogic(aMousePos);
+ Point aMousePos = EditViewOutputDevice().PixelToLogic(rPosition);
m_xEditView->SetCursorLogicPosition(aMousePos, false, true);
ESelection aSelection = m_xEditView->GetSelection();
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 631c70f7a0bf..aceb8a9d1d9d 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -399,8 +399,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
// destroyed after the paste.
SwView* pView = &rView;
bool bRet = false;
- SotClipboardFormatId nFormatId = SotClipboardFormatId::NONE;
- nFormatId = pDlg->GetFormatOnly();
+ SotClipboardFormatId nFormatId = pDlg->GetFormatOnly();
if( nFormatId != SotClipboardFormatId::NONE )
bRet = SwTransferable::PasteFormat( rSh, *aDataHelper, nFormatId );
diff --git a/test/source/table/tablecolumn.cxx b/test/source/table/tablecolumn.cxx
index 52e688234c46..3dc50e93e9cb 100644
--- a/test/source/table/tablecolumn.cxx
+++ b/test/source/table/tablecolumn.cxx
@@ -28,9 +28,7 @@ void TableColumn::testTableColumnProperties()
{
uno::Reference<beans::XPropertySet> xPS(init(), uno::UNO_QUERY_THROW);
- OUString aPropName;
-
- aPropName = "Width";
+ OUString aPropName = "Width";
testLongProperty(xPS, aPropName);
// currently changing the value to false has no effect
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index 772f4b9b9504..c489e349c74b 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -134,8 +134,7 @@ void SdtHelper::createDateContentControl(bool bInsideTable)
return;
}
- uno::Reference<uno::XInterface> xFieldInterface;
- xFieldInterface
+ uno::Reference<uno::XInterface> xFieldInterface
= m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.Fieldmark");
uno::Reference<text::XFormField> xFormField(xFieldInterface, uno::UNO_QUERY);
uno::Reference<text::XTextContent> xToInsert(xFormField, uno::UNO_QUERY);
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index c8a96c3335b7..9113131f1d33 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -117,8 +117,7 @@ OUString ControlElement::getControlModelName(
OUString const& rDefaultModel,
Reference< xml::input::XAttributes > const & xAttributes )
{
- OUString aModel;
- aModel = xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "control-implementation");
+ OUString aModel = xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "control-implementation");
if (aModel.isEmpty())
aModel = rDefaultModel;
return aModel;
diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
index 02a1f900e390..ed1ca3da901e 100644
--- a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
+++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
@@ -166,8 +166,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
OUString aLibElementName( aPrefix );
aLibElementName += ":library-linked";
XMLElement* pLibElement = new XMLElement( aLibElementName );
- Reference< xml::sax::XAttributeList > xLibAttribs;
- xLibAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
+ Reference< xml::sax::XAttributeList > xLibAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
// ooo/script:name attribute
pLibElement->addAttribute( aPrefix + ":name", rLibName );
@@ -202,8 +201,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
OUString aLibElementName( aPrefix );
aLibElementName += ":library-embedded";
XMLElement* pLibElement = new XMLElement( aLibElementName );
- Reference< xml::sax::XAttributeList > xLibAttribs;
- xLibAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
+ Reference< xml::sax::XAttributeList > xLibAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
// ooo/script:name attribute
pLibElement->addAttribute( aPrefix + ":name", rLibName );
@@ -240,8 +238,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
OUString aModElementName( aPrefix );
aModElementName += ":module";
XMLElement* pModElement = new XMLElement( aModElementName );
- Reference< xml::sax::XAttributeList > xModAttribs;
- xModAttribs = static_cast< xml::sax::XAttributeList* >( pModElement );
+ Reference< xml::sax::XAttributeList > xModAttribs = static_cast< xml::sax::XAttributeList* >( pModElement );
// ooo/script:name attribute
pModElement->addAttribute( aPrefix + ":name", rModName );
@@ -254,8 +251,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
OUString aSourceElementName( aPrefix );
aSourceElementName += ":source-code";
XMLElement* pSourceElement = new XMLElement( aSourceElementName );
- Reference< xml::sax::XAttributeList > xSourceAttribs;
- xSourceAttribs = static_cast< xml::sax::XAttributeList* >( pSourceElement );
+ Reference< xml::sax::XAttributeList > xSourceAttribs = static_cast< xml::sax::XAttributeList* >( pSourceElement );
// <ooo/script:source-code...
m_xHandler->ignorableWhitespace( OUString() );
diff --git a/xmlscript/source/xmllib_imexp/xmllib_export.cxx b/xmlscript/source/xmllib_imexp/xmllib_export.cxx
index 5353c1c245ec..97764e4292c2 100644
--- a/xmlscript/source/xmllib_imexp/xmllib_export.cxx
+++ b/xmlscript/source/xmllib_imexp/xmllib_export.cxx
@@ -63,8 +63,7 @@ exportLibraryContainer(
LibDescriptor& rLib = pLibArray->mpLibs[i];
XMLElement* pLibElement = new XMLElement( XMLNS_LIBRARY_PREFIX ":library" );
- Reference< xml::sax::XAttributeList > xLibElementAttribs;
- xLibElementAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
+ Reference< xml::sax::XAttributeList > xLibElementAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name", rLib.aName );
@@ -121,8 +120,7 @@ exportLibrary(
for( const auto& rElementName : rLib.aElementNames )
{
XMLElement* pElement = new XMLElement( XMLNS_LIBRARY_PREFIX ":element" );
- Reference< xml::sax::XAttributeList > xElementAttribs;
- xElementAttribs = static_cast< xml::sax::XAttributeList* >( pElement );
+ Reference< xml::sax::XAttributeList > xElementAttribs = static_cast< xml::sax::XAttributeList* >( pElement );
pElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name",
rElementName );