diff options
74 files changed, 183 insertions, 124 deletions
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index 7e20c261435d..5f5089ab5dbb 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -376,7 +376,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( ToolBox::ImplToolItems::size_type _ // TODO: we should make this dependent on the existence of event listeners // with the current implementation, we always create accessible object - Any aNewChild = Any( getAccessibleChild( static_cast<sal_Int32>(_nPos) ) ); + Any aNewChild( getAccessibleChild( static_cast<sal_Int32>(_nPos) ) ); //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32! NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewChild ); } diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 16e73e6da2f0..2cf0a44dcaf5 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -1087,7 +1087,7 @@ namespace basctl for (auto const& doc : aDocuments) { - const ScriptDocument aCheck = ScriptDocument( doc.xModel ); + const ScriptDocument aCheck( doc.xModel ); if ( _rUrlOrCaption == aCheck.getTitle() || _rUrlOrCaption == aCheck.m_pImpl->getURL() ) diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index d23563714196..2c10c81c0eab 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -302,7 +302,7 @@ Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const bool bNotLocalized = !m_xLocalizationMgr->isLibraryLocalized(); if (bNotLocalized) { - LanguageType eType = LanguageType(m_xLanguageLB->get_selected_id().toUInt32()); + LanguageType eType(m_xLanguageLB->get_selected_id().toUInt32()); Sequence<Locale> aLocaleSeq(1); aLocaleSeq[0] = LanguageTag(eType).getLocale(); return aLocaleSeq; @@ -313,7 +313,7 @@ Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const { if (m_xCheckLangLB->get_toggle(i, 0) == TRISTATE_TRUE) { - LanguageType eType = LanguageType(m_xCheckLangLB->get_id(i).toUInt32()); + LanguageType eType(m_xCheckLangLB->get_id(i).toUInt32()); aLocaleSeq.push_back(LanguageTag::convertToLocale(eType)); } } diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 63d88e18a007..a2f2dcb347ae 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -380,7 +380,7 @@ void ChartController::executeDispatch_InsertTrendline() // open dialog SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet(); aItemConverter.FillItemSet( aItemSet ); - ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( + ObjectPropertiesDialogParameter aDialogParameter( ObjectIdentifier::createDataCurveCID( ObjectIdentifier::getSeriesParticleFromCID( m_aSelection.getSelectedCID()), RegressionCurveHelper::getRegressionCurveIndex( xRegressionCurveContainer, xCurve ), false )); @@ -439,7 +439,7 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError ) SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet(); aItemSet.Put(SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE,bYError)); aItemConverter.FillItemSet( aItemSet ); - ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( + ObjectPropertiesDialogParameter aDialogParameter( ObjectIdentifier::createClassifiedIdentifierWithParent( objType, OUString(), m_aSelection.getSelectedCID())); aDialogParameter.init( getModel() ); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 9a0242081da2..9ba3f1f712e4 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -753,7 +753,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( pItemConverter->FillItemSet(aItemSet); //prepare dialog - ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( rObjectCID ); + ObjectPropertiesDialogParameter aDialogParameter( rObjectCID ); aDialogParameter.init( getModel() ); ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() ); diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index f11c58787f0b..e20d23494f63 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -386,7 +386,7 @@ void SAL_CALL ChartTypeTemplate::applyStyle( try { StackMode eStackMode = getStackMode( nChartTypeIndex ); - const uno::Any aPropValue = uno::Any( + const uno::Any aPropValue( ( (eStackMode == StackMode::YStacked) || (eStackMode == StackMode::YStackedPercent) ) ? chart2::StackingDirection_Y_STACKING diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx index adc04802925b..8a9717ac221c 100644 --- a/chart2/source/tools/LifeTime.cxx +++ b/chart2/source/tools/LifeTime.cxx @@ -131,8 +131,7 @@ bool LifeTimeManager::dispose() //--do the disposing of listeners after calling this method { - uno::Reference< lang::XComponent > xComponent = - uno::Reference< lang::XComponent >(m_pComponent); + uno::Reference< lang::XComponent > xComponent(m_pComponent); if(xComponent.is()) { // notify XCLoseListeners @@ -217,8 +216,7 @@ bool CloseableLifeTimeManager::g_close_startTryClose(bool bDeliverOwnership) try { - uno::Reference< util::XCloseable > xCloseable = - uno::Reference< util::XCloseable >(m_pCloseable); + uno::Reference< util::XCloseable > xCloseable(m_pCloseable); if(xCloseable.is()) { //--call queryClosing on all registered close listeners diff --git a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx index b9d342cbe519..43088acc364a 100644 --- a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx +++ b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx @@ -113,7 +113,7 @@ OUString MeanValueRegressionCurveCalculator::ImplGetRepresentation( const uno::Reference< util::XNumberFormatter >& xNumFormatter, sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength /* = nullptr */ ) const { - OUString aBuf = OUString(mYName + " = "); + OUString aBuf(mYName + " = "); if ( pFormulaLength ) { *pFormulaLength -= aBuf.getLength(); diff --git a/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx b/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx index 5b72c329691d..66e43b96f67b 100644 --- a/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx +++ b/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx @@ -626,6 +626,11 @@ public: if( !externVar->VisitVarDecl( arg )) externVar = nullptr; } + if( simplifyConstruct != nullptr ) + { + if( !simplifyConstruct->VisitVarDecl( arg )) + simplifyConstruct = nullptr; + } if( stringStatic != nullptr ) { if( !stringStatic->VisitVarDecl( arg )) diff --git a/compilerplugins/clang/simplifyconstruct.cxx b/compilerplugins/clang/simplifyconstruct.cxx index 652a980cec6a..c3e28ce7bcda 100644 --- a/compilerplugins/clang/simplifyconstruct.cxx +++ b/compilerplugins/clang/simplifyconstruct.cxx @@ -31,6 +31,7 @@ public: virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } bool VisitCXXConstructExpr(CXXConstructExpr const*); + bool VisitVarDecl(VarDecl const*); // ignore some contexts within which nullptr is fine bool TraverseReturnStmt(ReturnStmt*) { return true; } @@ -69,6 +70,42 @@ bool SimplifyConstruct::VisitCXXConstructExpr(CXXConstructExpr const* constructE return true; } +bool SimplifyConstruct::VisitVarDecl(VarDecl const* varDecl) +{ + if (ignoreLocation(varDecl)) + return true; + // cannot use OUString s("xxx") style syntax in a parameter + if (isa<ParmVarDecl>(varDecl)) + return true; + varDecl = varDecl->getCanonicalDecl(); + if (!varDecl->getInit()) + return true; + if (varDecl->getInitStyle() != VarDecl::InitializationStyle::CInit) + return true; + if (!varDecl->getType()->isRecordType()) + return true; + if (isa<AutoType>(varDecl->getType())) + return true; + + auto init = varDecl->getInit()->IgnoreImplicit(); + auto functionalCast = dyn_cast<CXXFunctionalCastExpr>(init); + if (!functionalCast) + return true; + + // e.g. the LANGUAGE_DONTKNOW defines + if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(init))) + return true; + + // varDecl->getInit()->IgnoreImplicit()->dump(); + // varDecl->getType()->dump(); + // varDecl->getType()->getUnqualifiedDesugaredType()->dump(); + + report(DiagnosticsEngine::Warning, "simplify", varDecl->getLocation()) + << varDecl->getSourceRange(); + + return true; +} + loplugin::Plugin::Registration<SimplifyConstruct> simplifyconstruct("simplifyconstruct", true); } diff --git a/compilerplugins/clang/test/simplifyconstruct.cxx b/compilerplugins/clang/test/simplifyconstruct.cxx index ca4b3a1a198c..8fbffc8ba2d7 100644 --- a/compilerplugins/clang/test/simplifyconstruct.cxx +++ b/compilerplugins/clang/test/simplifyconstruct.cxx @@ -10,6 +10,8 @@ #include <memory> #include <rtl/ref.hxx> +namespace test1 +{ struct Foo { void acquire(); @@ -27,8 +29,11 @@ class Foo1 { } }; +} // no warning expected when using std::unique_ptr constructor with a custom deleter +namespace test2 +{ struct ITypeLib { }; @@ -43,5 +48,31 @@ void func2() p->Release(); }); } +} + +namespace test3 +{ +struct Foo +{ + void acquire(); + void release(); +}; +void f(Foo* f) +{ + // expected-error@+1 {{simplify [loplugin:simplifyconstruct]}} + rtl::Reference<Foo> x = rtl::Reference(f); +} +} + +// no warning expected +namespace test4 +{ +struct Foo +{ + void acquire(); + void release(); +}; +void f(Foo* f) { auto x = rtl::Reference(f); } +} /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx index e93e7b01e424..811e0fb7c70f 100644 --- a/connectivity/source/commontools/RowFunctionParser.cxx +++ b/connectivity/source/commontools/RowFunctionParser.cxx @@ -212,7 +212,7 @@ public: rNodeStack.pop(); // create combined ExpressionNode - std::shared_ptr<ExpressionNode> pNode = std::shared_ptr<ExpressionNode>( new BinaryFunctionExpression( meFunct, pFirstArg, pSecondArg ) ); + std::shared_ptr<ExpressionNode> pNode( new BinaryFunctionExpression( meFunct, pFirstArg, pSecondArg ) ); // check for constness rNodeStack.push( pNode ); } diff --git a/cppu/qa/test_any.cxx b/cppu/qa/test_any.cxx index b8a8037f8f48..f5fbc0c9dbc8 100644 --- a/cppu/qa/test_any.cxx +++ b/cppu/qa/test_any.cxx @@ -2012,7 +2012,7 @@ void Test::testInterface() { } void Test::testNull() { - css::uno::Any a = css::uno::Any(css::uno::Reference< Interface2a >()); + css::uno::Any a { css::uno::Reference< Interface2a >() }; CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Interface2a>::get())); { bool b = true; diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index bd6487186c50..2796a2ddd910 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2720,7 +2720,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow, if ( graphics.getLength() > 0 ) { m_aGraphics.push_back(graphics[0]); - Image img = Image(graphics[0]); + Image img(graphics[0]); m_xTbSymbol->InsertItem(m_aGraphics.size(), img, elem.first); } } @@ -2765,7 +2765,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow, if ( graphics.getLength() > 0 ) { - Image img = Image(graphics[0]); + Image img(graphics[0]); if (!img.GetBitmapEx().IsEmpty()) { m_aGraphics.push_back(graphics[0]); diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index 1d38a7d3b5f6..e567944d226c 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -58,9 +58,9 @@ namespace OUString lcl_AltDescr() { - OUString aTempl = OUString("<alt id=\"%1\">" - " " //FIXME real dialog title or something - "</alt>"); + OUString aTempl("<alt id=\"%1\">" + " " //FIXME real dialog title or something + "</alt>"); aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("alt_id") ); return aTempl; @@ -68,10 +68,10 @@ namespace OUString lcl_Image( const OUString& rScreenshotId, const Size& rSize ) { - OUString aTempl = OUString("<image id=\"%1\" src=\"media/screenshots/%2.png\"" - " width=\"%3cm\" height=\"%4cm\">" - "%5" - "</image>"); + OUString aTempl("<image id=\"%1\" src=\"media/screenshots/%2.png\"" + " width=\"%3cm\" height=\"%4cm\">" + "%5" + "</image>"); aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("img_id") ); aTempl = aTempl.replaceFirst( "%2", rScreenshotId ); aTempl = aTempl.replaceFirst( "%3", OUString::number( rSize.Width() ) ); @@ -83,8 +83,8 @@ namespace OUString lcl_ParagraphWithImage( const OUString& rScreenshotId, const Size& rSize ) { - OUString aTempl = OUString( "<paragraph id=\"%1\" role=\"paragraph\">%2" - "</paragraph>" SAL_NEWLINE_STRING ); + OUString aTempl( "<paragraph id=\"%1\" role=\"paragraph\">%2" + "</paragraph>" SAL_NEWLINE_STRING ); aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("par_id") ); aTempl = aTempl.replaceFirst( "%2", lcl_Image(rScreenshotId, rSize) ); diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 59450974e1b0..021aaecd550f 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -667,7 +667,7 @@ void RequestHandler::EnableRequests() pGlobal->mState = State::RequestsEnabled; } // hit the compiler over the head - ProcessDocumentsRequest aEmptyReq = ProcessDocumentsRequest( boost::optional< OUString >() ); + ProcessDocumentsRequest aEmptyReq { boost::optional< OUString >() }; // trigger already queued requests RequestHandler::ExecuteCmdLineRequests(aEmptyReq, true); } diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx index 62de9ec5aac0..3f601f84d47a 100644 --- a/drawinglayer/source/tools/converters.cxx +++ b/drawinglayer/source/tools/converters.cxx @@ -101,7 +101,7 @@ namespace drawinglayer if(bDoSaveForVisualControl) { SvFileStream aNew("c:\\test_content.png", StreamMode::WRITE|StreamMode::TRUNC); - BitmapEx aContentEx = BitmapEx(aContent); + BitmapEx aContentEx(aContent); vcl::PNGWriter aPNGWriter(aContentEx); aPNGWriter.Write(aNew); } @@ -132,7 +132,7 @@ namespace drawinglayer if(bDoSaveForVisualControl) { SvFileStream aNew("c:\\test_alpha.png", StreamMode::WRITE|StreamMode::TRUNC); - BitmapEx aAlphaEx = BitmapEx(aAlpha); + BitmapEx aAlphaEx(aAlpha); vcl::PNGWriter aPNGWriter(aAlphaEx); aPNGWriter.Write(aNew); } diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 01759a632ce8..bf79026a72c6 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1815,7 +1815,7 @@ bool SvxBoxItem::GetPresentation OUString& rText, const IntlWrapper& rIntl ) const { - OUString cpDelimTmp = OUString(cpDelim); + OUString cpDelimTmp(cpDelim); switch ( ePres ) { case SfxItemPresentation::Nameless: diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 0ee639ca2194..cfd4ca6f655e 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1234,7 +1234,7 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPo const LanguageType eLang = GetDocLanguage( rDoc, nInsPos ); sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang ); - OUString sRet = OUString(cRet); + OUString sRet(cRet); if( '\"' == cInsChar ) { diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index 1dc03182aa15..979f13e3e78f 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -61,7 +61,7 @@ Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int // define an invisible button with the size of a page tools::Rectangle aRect( 0, 0, static_cast<long>( mnDocWidth * mnDocXScale ), static_cast<long>( mnDocHeight * mnDocYScale ) ); tools::Polygon aPoly( aRect ); - FillStyle aFill = FillStyle( COL_WHITE ); + FillStyle aFill( COL_WHITE ); sal_uInt16 nWhiteBackgroundShapeId = defineShape( aPoly, aFill ); ::basegfx::B2DHomMatrix m; // #i73264# diff --git a/i18npool/source/indexentry/genindex_data.cxx b/i18npool/source/indexentry/genindex_data.cxx index 871b742d9b86..a6f054138df3 100644 --- a/i18npool/source/indexentry/genindex_data.cxx +++ b/i18npool/source/indexentry/genindex_data.cxx @@ -48,7 +48,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) sal_Int32 i, j, k; sal_Int32 address[MAX_ADDRESS]; for (i=0; i<MAX_ADDRESS; i++) address[i]=-1; - OUString sep=OUString('|'); + OUString sep('|'); OUStringBuffer result=sep; sal_Int32 max=0; diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index 64373f31c8b0..57134e19b35d 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -409,8 +409,7 @@ void NodeJava::write() const //The element must exist if (m_enabled) { - OString sExpression= OString( - "/jf:java/jf:enabled"); + OString sExpression("/jf:java/jf:enabled"); pathObj = xmlXPathEvalExpression(reinterpret_cast<xmlChar const *>(sExpression.getStr()), contextUser); if ( ! pathObj || xmlXPathNodeSetIsEmpty(pathObj->nodesetval)) @@ -432,8 +431,7 @@ void NodeJava::write() const //The element must exist if (m_userClassPath) { - OString sExpression= OString( - "/jf:java/jf:userClassPath"); + OString sExpression("/jf:java/jf:userClassPath"); pathObj = xmlXPathEvalExpression(reinterpret_cast<xmlChar const *>(sExpression.getStr()), contextUser); if ( ! pathObj || xmlXPathNodeSetIsEmpty(pathObj->nodesetval)) @@ -447,8 +445,7 @@ void NodeJava::write() const //set <javaInfo> element if (m_javaInfo) { - OString sExpression= OString( - "/jf:java/jf:javaInfo"); + OString sExpression("/jf:java/jf:javaInfo"); pathObj = xmlXPathEvalExpression(reinterpret_cast<xmlChar const *>(sExpression.getStr()), contextUser); if ( ! pathObj || xmlXPathNodeSetIsEmpty(pathObj->nodesetval)) @@ -460,8 +457,7 @@ void NodeJava::write() const //set <vmParameters> element if (m_vmParameters) { - OString sExpression= OString( - "/jf:java/jf:vmParameters"); + OString sExpression("/jf:java/jf:vmParameters"); pathObj = xmlXPathEvalExpression(reinterpret_cast<xmlChar const *>(sExpression.getStr()), contextUser); if ( ! pathObj || xmlXPathNodeSetIsEmpty(pathObj->nodesetval)) @@ -500,8 +496,7 @@ void NodeJava::write() const //set <jreLocations> element if (m_JRELocations) { - OString sExpression= OString( - "/jf:java/jf:jreLocations"); + OString sExpression("/jf:java/jf:jreLocations"); pathObj = xmlXPathEvalExpression(reinterpret_cast<xmlChar const *>(sExpression.getStr()), contextUser); if ( ! pathObj || xmlXPathNodeSetIsEmpty(pathObj->nodesetval)) diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx index c3ee592a5463..17120e5a4ada 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx @@ -87,7 +87,7 @@ void LOKDocViewSigHandlers::commandChanged(LOKDocView* pDocView, char* pPayload, } else if (aKey == ".uno:TrackedChangeIndex") { - std::string aText = std::string("Current redline: "); + std::string aText("Current redline: "); if (aValue.empty()) aText += "none"; else diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index 071cb8d310df..7c2c602a79fa 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -93,7 +93,7 @@ static void ReadThroughDic( const OUString &rMainURL, ConvDicXMLImport &rImport if (!xIn.is()) return; - SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xIn ) ); + SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xIn ) ); // prepare ParserInputSource xml::sax::InputSource aParserInput; @@ -246,7 +246,7 @@ void ConvDic::Save() if (!xStream.is()) return; - SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); + SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) ); // get XML writer uno::Reference< xml::sax::XWriter > xSaxWriter = xml::sax::Writer::create(xContext); diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index b99f632c9842..f6a976679641 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -293,7 +293,7 @@ ErrCode DictionaryNeo::loadEntries(const OUString &rMainURL) if (!xStream.is()) return ErrCode(sal_uInt32(-1)); - SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); + SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) ); // read header bool bNegativ; @@ -427,7 +427,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL) if (!xStream.is()) return ErrCode(sal_uInt32(-1)); - SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); + SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) ); // Always write as the latest version, i.e. DIC_VERSION_7 diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 9ca759a18da3..115fdca74669 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -820,7 +820,7 @@ static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& if (!xStream.is()) return false; - SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); + SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) ); int nDicVersion = ReadDicVersion(pStream, nLng, bNeg, aDicName); return 2 == nDicVersion || nDicVersion >= 5; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e259aa856906..a5e8f48f6dff 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1776,7 +1776,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool && eState == beans::PropertyState_DIRECT_VALUE) || GetProperty(rXPropSet, "CharUnderlineColor"))) { - ::Color color = ::Color(*o3tl::doAccess<sal_uInt32>(mAny)); + ::Color color(*o3tl::doAccess<sal_uInt32>(mAny)); // if color is automatic, then we shouldn't write information about color but to take color from character if( color != COL_AUTO ) { diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index 7fc2effb5f03..12532e03c01f 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -227,7 +227,7 @@ bool osl_searchPath( bool bfound = false; OUString fp(const_cast<rtl_uString*>(pustrFilePath)); - OUString pl = OUString(const_cast<rtl_uString*>(pustrSearchPathList)); + OUString pl(const_cast<rtl_uString*>(pustrSearchPathList)); path_list_iterator pli(pl); while (!pli.done()) diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index b36c3ddc1790..d797de1c5028 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -388,7 +388,7 @@ int ftruncate_with_name(int fd, sal_uInt64 uSize, rtl_String* path) * abstraction layer that keeps the pathname around. */ - OString fn = OString(path); + OString fn(path); #ifdef MACOSX fn = macxp_resolveAliasAndConvert(fn); diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 53e4d82eeb8b..53e9e63fc548 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -1403,7 +1403,7 @@ BitmapEx& ScIconSetFormat::getBitmap(sc::IconSetBitmapMap & rIconSetBitmapMap, if (itr != rIconSetBitmapMap.end()) return itr->second; - BitmapEx aBitmap = BitmapEx(sBitmap); + BitmapEx aBitmap(sBitmap); std::pair<OUString, BitmapEx> aPair(sBitmap, aBitmap); std::pair<std::map<OUString, BitmapEx>::iterator, bool> itrNew = rIconSetBitmapMap.insert(aPair); assert(itrNew.second); diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index d9d7da3d501c..8c55b0f2f790 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -924,7 +924,7 @@ size_t DynamicKernelStringArgument::Marshal( cl_kernel k, int argno, int, cl_pro { if (vRef.mpStringArray[i]) { - const OUString tmp = OUString(vRef.mpStringArray[i]); + const OUString tmp(vRef.mpStringArray[i]); pHashBuffer[i] = tmp.hashCode(); } else diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 264a4d042488..d0038dd32379 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1602,7 +1602,7 @@ XclExpColinfo::XclExpColinfo( const XclExpRoot& rRoot, // column flags ::set_flag( mnFlags, EXC_COLINFO_HIDDEN, rDoc.ColHidden(nScCol, nScTab) ); - XclExpDefcolwidth defColWidth = XclExpDefcolwidth( rRoot ); + XclExpDefcolwidth defColWidth( rRoot ); mbCustomWidth = !defColWidth.IsDefWidth( mnWidth ); set_flag(mnFlags, EXC_COLINFO_CUSTOMWIDTH, mbCustomWidth); diff --git a/sc/source/ui/app/rfindlst.cxx b/sc/source/ui/app/rfindlst.cxx index f0188a9fbeb3..9a27a0d0e298 100644 --- a/sc/source/ui/app/rfindlst.cxx +++ b/sc/source/ui/app/rfindlst.cxx @@ -54,8 +54,8 @@ Color ScRangeFindList::FindColor( const ScRange& rRef, const size_t nIndex ) { sal_Int32 nOldCntr = 0; sal_Int32 nNewCntr = 0; - Color nOldColor = Color(0); - Color nNewColor = Color(0); + Color nOldColor(0); + Color nNewColor(0); DBG_ASSERT( (nIndex < maEntries.size()), "nIndex out of range!" ); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index f2ad828d95fe..0d3d52bb353e 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2802,7 +2802,7 @@ void ScViewData::WriteUserData(OUString& rData) rData += ";"; // Numbering must not get mixed up under any circumstances if (i < static_cast<SCTAB>(maTabData.size()) && maTabData[i]) { - OUString cTabSep = OUString(SC_OLD_TABSEP); // like 3.1 + OUString cTabSep(SC_OLD_TABSEP); // like 3.1 if ( maTabData[i]->nCurY > MAXROW_30 || maTabData[i]->nPosY[0] > MAXROW_30 || maTabData[i]->nPosY[1] > MAXROW_30 || ( maTabData[i]->eVSplitMode == SC_SPLIT_FIX && diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 5b8f77f9a744..7c27e0a315cc 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -669,7 +669,7 @@ void SdOOXMLExportTest2::testPresetShapesExport() size_t i = 0; while(i < SAL_N_ELEMENTS( sShapeTypeAndValues )) { - OString sType = OString( sShapeTypeAndValues[ i++ ] ); + OString sType( sShapeTypeAndValues[ i++ ] ); for ( size_t j = 1 ; i < SAL_N_ELEMENTS( sShapeTypeAndValues ) && OString(sShapeTypeAndValues[i]).startsWith("adj") ; ++j ) { OString sXPath= sPattern.replaceFirst( sT, sType).replaceFirst( sN, OString::number(j) ); assertXPath(pXmlDocCT, sXPath, sPropertyName , OUString::createFromAscii(sShapeTypeAndValues[ i++ ]) ); diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 057e15e1908f..0c60e860bcfa 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2745,7 +2745,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportPPT(SvStream &rStream) bool bRet = false; try { - tools::SvRef<SotStorage> xStorage = tools::SvRef<SotStorage>(new SotStorage(rStream)); + tools::SvRef<SotStorage> xStorage(new SotStorage(rStream)); if (xStorage->GetError()) return false; diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 12bb79851bea..6f0a3efbd62e 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -1859,7 +1859,7 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage(weld::Container* pPar { sal_Int32 nColor = 0; aDimColor >>= nColor; - Color aColor = Color(nColor); + Color aColor(nColor); mxCLBDimColor->SelectEntry(aColor); } else diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index 186c407e0095..3f9b7cef8378 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -532,7 +532,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl, weld::Button&, void) for ( sal_Int32 i = 0; i < aFilesArr.getLength(); i++ ) { // Store full path, show filename only. Use INetURLObject to display spaces in filename correctly - INetURLObject aUrl = INetURLObject(aFilesArr[i]); + INetURLObject aUrl(aFilesArr[i]); m_xImagesLst->append(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), aUrl.GetLastName(INetURLObject::DecodeMechanism::WithCharset), ""); } } diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx index b7976d9c55ca..f495ef6a4810 100644 --- a/sd/source/ui/slidesorter/view/SlsTheme.cxx +++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx @@ -31,8 +31,8 @@ namespace sd { namespace slidesorter { namespace view { -const static Color Black = Color(0x000000); -const static Color White = Color(0xffffff); +const static Color Black(0x000000); +const static Color White(0xffffff); static Color ChangeLuminance (Color aColor, const int nValue) { diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index b26578c5ea52..10141a85b467 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -842,7 +842,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) std::vector<OUString> aBackupList; OUString aSidebarMode; - OUStringBuffer aPath = OUStringBuffer( "org.openoffice.Office.UI.ToolbarMode/Applications/" ); + OUStringBuffer aPath( "org.openoffice.Office.UI.ToolbarMode/Applications/" ); aPath.append( lcl_getAppName( eApp ) ); aPath.append( "/Modes" ); diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 56cb15663268..646b4bd77c30 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -2795,7 +2795,7 @@ IMPL_LINK_NOARG(SfxHelpWindow_Impl, OpenHdl, Control*, bool) else { OUString aId; - OUString aAnchor = OUString('#'); + OUString aAnchor('#'); if ( comphelper::string::getTokenCount(aEntry, '#') == 2 ) { sal_Int32 nIdx{ 0 }; diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index d3fad16db845..4575fa31a386 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -270,7 +270,7 @@ void BackingWindow::initControls() mpHelpButton->SetControlForeground(maButtonsTextColor); mpExtensionsButton->SetControlForeground(maButtonsTextColor); - const Color aButtonsBackground = Color(officecfg::Office::Common::Help::StartCenter::StartCenterBackgroundColor::get()); + const Color aButtonsBackground(officecfg::Office::Common::Help::StartCenter::StartCenterBackgroundColor::get()); mpAllButtonsBox->SetBackground(aButtonsBackground); mpSmallButtonsBox->SetBackground(aButtonsBackground); diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index e1501a602ab1..f0ef80dc32e9 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -349,7 +349,7 @@ namespace slideshow // render at given output position pBitmap->move( aOutPosPixel ); - ::basegfx::B2DPolyPolygon aPolyPoly=::basegfx::B2DPolyPolygon(aPoly); + ::basegfx::B2DPolyPolygon aPolyPoly(aPoly); aViewTransform.translate(-aOutPosPixel.getX(), -aOutPosPixel.getY()); aPolyPoly.transform(aViewTransform); // set clip so that we just redraw a part of the canvas diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx index 4185b5033752..65c32b66e46f 100644 --- a/slideshow/source/engine/transitions/combtransition.cxx +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -117,7 +117,7 @@ void CombTransition::renderComb( double t, const basegfx::B2DSize enteringSizePixel( getEnteringSlideSizePixel( rViewEntry.mpView) ); - const basegfx::B2DVector aPushDirection = basegfx::B2DVector( + const basegfx::B2DVector aPushDirection( enteringSizePixel * maPushDirectionUnit ); const basegfx::B2DPolyPolygon aClipPolygon1 = createClipPolygon( maPushDirectionUnit, diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index 199c438c7ae9..a6922789dc5b 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -1132,8 +1132,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl StreamMode::STD_WRITE ); if ( pStream && !pStream->GetError() ) { - uno::Reference< io::XStream > xStream = - uno::Reference < io::XStream >( new ::utl::OStreamWrapper( std::move(pStream) ) ); + uno::Reference< io::XStream > xStream( new ::utl::OStreamWrapper( std::move(pStream) ) ); xResult = new OFSStreamContainer(xStream); } } diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 00a8df04ed9d..0f27d4c65a05 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -2167,7 +2167,7 @@ void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor ) VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { - Color aColor = Color( nColor ); + Color aColor( nColor ); pWindow->SetBackground( aColor ); pWindow->SetControlBackground( aColor ); pWindow->Invalidate(); @@ -2255,7 +2255,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const css::uno: sal_Int32 nColor = 0; if ( Value >>= nColor ) { - Color aColor = Color( nColor ); + Color aColor( nColor ); pWindow->SetControlForeground( aColor ); } } diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx index 363287dabcf9..b3800b6dfef5 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx @@ -864,7 +864,7 @@ public: rNodeStack.pop(); // create combined ExpressionNode - std::shared_ptr<ExpressionNode> pNode = std::shared_ptr<ExpressionNode>( new BinaryFunctionExpression( meFunct, pFirstArg, pSecondArg ) ); + std::shared_ptr<ExpressionNode> pNode( new BinaryFunctionExpression( meFunct, pFirstArg, pSecondArg ) ); // check for constness if( pFirstArg->isConstant() && pSecondArg->isConstant() ) // call the operator() at pNode, store result in constant value ExpressionNode. rNodeStack.push( std::shared_ptr<ExpressionNode>( new ConstantValueExpression( (*pNode)() ) ) ); diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index c49e81b8973f..8ca89e14aab7 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -161,7 +161,7 @@ void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl ) MapControlModels aModelAssignment; typedef TreeVisitor< FormComponentPair, FormHierarchyComparator, FormComponentAssignment > FormComponentVisitor; - FormComponentVisitor aVisitor = FormComponentVisitor( FormHierarchyComparator() ); + FormComponentVisitor aVisitor{ FormHierarchyComparator() }; FormComponentAssignment aAssignmentProcessor( aModelAssignment ); aVisitor.process( FormComponentPair( xForeignForms, m_xForms ), aAssignmentProcessor ); diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index cffccb570087..4d9a7baecebd 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -199,7 +199,7 @@ bool SvxMarginItem::GetPresentation OUString& rText, const IntlWrapper& rIntl ) const { - OUString cpDelimTmp = OUString(cpDelim); + OUString cpDelimTmp(cpDelim); switch ( ePres ) { diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index bbf80d45d5c0..d7b1b619b57f 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -104,7 +104,7 @@ bool SvxPageItem::GetPresentation ) const { rText.clear(); - OUString cpDelimTmp = OUString(cpDelim); + OUString cpDelimTmp(cpDelim); switch ( ePres ) { diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 9589035e3d30..c5d179d36e87 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -2079,8 +2079,8 @@ void SwDocTest::testTableCellComparison() CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A2", "Z2", "A1", "Z1", true) ); CPPUNIT_ASSERT_EQUAL( +1, sw_CompareCellRanges("A6", "Z2", "A1", "Z1", true) ); - OUString rCell1 = OUString("A1"); - OUString rCell2 = OUString("C5"); + OUString rCell1("A1"); + OUString rCell2("C5"); sw_NormalizeRange(rCell1, rCell2); CPPUNIT_ASSERT_EQUAL( OUString("A1"), rCell1 ); diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 5579c802833b..e08e29403d9d 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1052,7 +1052,7 @@ DECLARE_ODFEXPORT_TEST(testShapeRelsize, "shape-relsize.odt") DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.odt") { uno::Reference<drawing::XShape> xShape = getShape(1); - comphelper::SequenceAsHashMap aCustomShapeGeometry = comphelper::SequenceAsHashMap(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); + comphelper::SequenceAsHashMap aCustomShapeGeometry(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); // Test that the shape is a rounded rectangle. CPPUNIT_ASSERT_EQUAL(OUString("round-rectangle"), aCustomShapeGeometry["Type"].get<OUString>()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 82139b936f16..734ada046e6a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -868,7 +868,7 @@ DECLARE_OOXMLEXPORT_TEST(testCommentInitials, "comment_initials.odt") DECLARE_OOXMLEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.docx") { uno::Reference<drawing::XShape> xShape = getShape(1); - comphelper::SequenceAsHashMap aCustomShapeGeometry = comphelper::SequenceAsHashMap(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); + comphelper::SequenceAsHashMap aCustomShapeGeometry(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); // Test that the shape is a rounded rectangle. CPPUNIT_ASSERT_EQUAL(OUString("ooxml-roundRect"), aCustomShapeGeometry["Type"].get<OUString>()); diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 359144d5169e..53f09826a2c1 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -483,7 +483,7 @@ DECLARE_RTFEXPORT_TEST(testFdo61507, "fdo61507.rtf") mxComponent, uno::UNO_QUERY); uno::Reference<document::XDocumentProperties> xDocumentProperties( xDocumentPropertiesSupplier->getDocumentProperties()); - OUString aExpected = OUString(u"\u00C9\u00C1\u0150\u0170\u222D"); + OUString aExpected(u"\u00C9\u00C1\u0150\u0170\u222D"); CPPUNIT_ASSERT_EQUAL(aExpected, xDocumentProperties->getTitle()); // Only "Hello.", no additional characters. diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 693038a268dd..c63fc4064685 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -6855,11 +6855,11 @@ void SwUiWriterTest::testTdf108423() pWrtShell->AutoCorrect(corr, cChar); // The word "i" should be capitalized due to autocorrect, followed by a typographical apostrophe sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); - OUString sIApostrophe = OUString(u"I" + OUStringLiteral1(0x2019)); + OUString sIApostrophe(u"I" + OUStringLiteral1(0x2019)); CPPUNIT_ASSERT_EQUAL(sIApostrophe, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); pWrtShell->Insert(" i"); pWrtShell->AutoCorrect(corr, cChar); - OUString sText = OUString(sIApostrophe + u" " + sIApostrophe); + OUString sText(sIApostrophe + u" " + sIApostrophe); CPPUNIT_ASSERT_EQUAL(sText, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx index bef4c873dace..49cebffed0fa 100644 --- a/sw/source/core/crsr/DropDownFormFieldButton.cxx +++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx @@ -199,8 +199,7 @@ void DropDownFormFieldButton::Paint(vcl::RenderContext& rRenderContext, const to //const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); Color aLineColor = COL_BLACK; - Color aFillColor - = Color(lcl_GetFillColor(aLineColor.getBColor(), (m_pFieldPopup ? 0.5 : 0.75))); + Color aFillColor(lcl_GetFillColor(aLineColor.getBColor(), (m_pFieldPopup ? 0.5 : 0.75))); // Draw the frame around the field // GTK3 backend cuts down the frame's top and left border, to avoid that add a padding around the frame diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index fbd57a8e1b75..a116479520c3 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1461,7 +1461,7 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType, if( rOLEObj.IsOleRef() ) // Not yet loaded { - SvGlobalName aTmpName = SvGlobalName( rOLEObj.GetOleRef()->getClassID() ); + SvGlobalName aTmpName( rOLEObj.GetOleRef()->getClassID() ); SwTOOElements nObj = ::lcl_IsSOObject( aTmpName ); bInclude = ( (nMyOLEOptions & SwTOOElements::Other) && SwTOOElements::NONE == nObj ) || (nMyOLEOptions & nObj); diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 2827659def58..740b3cc1f99b 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -465,8 +465,8 @@ sal_uInt16 SwAutoFormat::CalcLevel(const SwTextFrame & rFrame, ++nLvl; } - for (TextFrameIndex n = TextFrameIndex(0), - nEnd = TextFrameIndex(rText.getLength()); n < nEnd; ++n) + for (TextFrameIndex n(0), + nEnd(rText.getLength()); n < nEnd; ++n) { switch (rText[sal_Int32(n)]) { @@ -514,8 +514,8 @@ bool SwAutoFormat::IsNoAlphaLine(const SwTextFrame & rFrame) const // or better: determine via number of AlphaNum and !AlphaNum characters sal_Int32 nANChar = 0, nBlnk = 0; - for (TextFrameIndex n = TextFrameIndex(0), - nEnd = TextFrameIndex(rStr.getLength()); n < nEnd; ++n) + for (TextFrameIndex n(0), + nEnd(rStr.getLength()); n < nEnd; ++n) if (IsSpace(rStr[sal_Int32(n)])) ++nBlnk; else @@ -741,8 +741,8 @@ sal_Int32 SwAutoFormat::GetTrailingBlanks( const OUString& rStr ) bool SwAutoFormat::IsFirstCharCapital(const SwTextFrame& rFrame) const { const OUString& rText = rFrame.GetText(); - for (TextFrameIndex n = TextFrameIndex(0), - nEnd = TextFrameIndex(rText.getLength()); n < nEnd; ++n) + for (TextFrameIndex n(0), + nEnd(rText.getLength()); n < nEnd; ++n) if (!IsSpace(rText[sal_Int32(n)])) { auto const pair = rFrame.MapViewToModel(n); diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 1546e71d6d61..6ad230c05075 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1427,7 +1427,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) // then there are RefFields in the DescDox - so all RefFields in the SourceDoc // need to be converted to have unique IDs for both documents - RefIdsMap aFntMap = RefIdsMap(OUString()); + RefIdsMap aFntMap { OUString() }; std::vector<std::unique_ptr<RefIdsMap>> aFieldMap; SwIterator<SwFormatField,SwFieldType> aIter( *this ); diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index e3bb28798d84..e47dc10c3a25 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1161,7 +1161,7 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset, if ( !IsEmpty() && !IsHiddenNow() ) { - TextFrameIndex nFormat = TextFrameIndex(COMPLETE_STRING); + TextFrameIndex nFormat(COMPLETE_STRING); do { if (nFormat != TextFrameIndex(COMPLETE_STRING) && !IsFollow() && diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 76fb43c1eb9e..d6fbbababd9e 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -185,7 +185,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, } bool bHyph = rInf.IsHyphenate() && !rInf.IsHyphForbud(); - TextFrameIndex nHyphPos = TextFrameIndex(0); + TextFrameIndex nHyphPos(0); // nCutPos is the first character not fitting to the current line // nHyphPos is the first character not fitting to the current line, diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 011490cc3568..312a7a7b38d2 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -946,7 +946,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, // all of the characters in this group are weak. We have to assign // the scripts to these characters depending on the fonts which are // set for these characters to display them. - TextFrameIndex nEnd = TextFrameIndex( + TextFrameIndex nEnd( g_pBreakIt->GetBreakIter()->endOfScript(rText, sal_Int32(nChg), WEAK)); if (nEnd > TextFrameIndex(rText.getLength()) || nEnd < TextFrameIndex(0)) diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 22a401be9514..875d3c1b90a0 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -307,14 +307,14 @@ SwDoubleLinePortion::SwDoubleLinePortion( SwFontScript nTmp = SW_SCRIPTS; if( pBracket->cPre > 255 ) { - OUString aText = OUString(pBracket->cPre); + OUString aText(pBracket->cPre); nTmp = SwScriptInfo::WhichFont(0, aText); } pBracket->nPreScript = nTmp; nTmp = SW_SCRIPTS; if( pBracket->cPost > 255 ) { - OUString aText = OUString(pBracket->cPost); + OUString aText(pBracket->cPost); nTmp = SwScriptInfo::WhichFont(0, aText); } pBracket->nPostScript = nTmp; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index ed39672d4f5a..ed312422a361 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2197,7 +2197,7 @@ TextFrameIndex SwFntObj::GetCursorOfst(SwDrawTextInfo &rInf) const long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf ); - for (TextFrameIndex j = TextFrameIndex(0); j < rInf.GetLen(); j++) + for (TextFrameIndex j(0); j < rInf.GetLen(); j++) { long nScr = pKernArray[sal_Int32(j)] + (nSpaceAdd + nGridWidthAdd) * (sal_Int32(j) + 1); if( nScr >= rInf.GetOfst()) diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 8ebd982fd635..a168f47203e3 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -235,7 +235,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken ) { SwContentNode *pCNd = m_xDoc->GetNodes()[pStartNdIdx->GetIndex()+1]->GetContentNode(); - SwNodeIndex aTmpSwNodeIndex = SwNodeIndex(*pCNd); + SwNodeIndex aTmpSwNodeIndex(*pCNd); SwPosition aNewPos( aTmpSwNodeIndex, SwIndex( pCNd, 0 ) ); SaveDocContext(xCntxt.get(), HtmlContextFlags::MultiColMask, &aNewPos); aId.clear(); diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 9d152e0d6bfa..0f304387ab58 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -1166,7 +1166,7 @@ bool SwFieldVarPage::FillItemSet(SfxItemSet* ) else { nSubType--; - OUString sSeparator = OUString(m_xSeparatorED->get_text()[0]); + OUString sSeparator(m_xSeparatorED->get_text()[0]); cSeparator = !sSeparator.isEmpty() ? sSeparator[0] : ' '; } break; diff --git a/sw/source/ui/vba/vbalisthelper.cxx b/sw/source/ui/vba/vbalisthelper.cxx index 0fed4ca41936..e1284240e4e0 100644 --- a/sw/source/ui/vba/vbalisthelper.cxx +++ b/sw/source/ui/vba/vbalisthelper.cxx @@ -379,7 +379,7 @@ void SwVbaListHelper::CreateOutlineNumberForType1() void SwVbaListHelper::CreateOutlineNumberForType2() { sal_Int16 nParentNumbering = 0; - OUString sSuffix = OUString( '.' ); + OUString sSuffix( '.' ); uno::Sequence< beans::PropertyValue > aPropertyValues; for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ ) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 55a61ac36307..4442f1714727 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -1155,7 +1155,7 @@ void VCLXWindow::setBackground( sal_Int32 nColor ) if ( GetWindow() ) { - Color aColor = Color(nColor); + Color aColor(nColor); GetWindow()->SetBackground( aColor ); GetWindow()->SetControlBackground( aColor ); @@ -1631,7 +1631,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& sal_Int32 nColor = 0; if ( Value >>= nColor ) { - Color aColor = Color( nColor ); + Color aColor( nColor ); pWindow->SetControlBackground( aColor ); pWindow->SetBackground( aColor ); switch ( eWinType ) @@ -1661,7 +1661,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& sal_Int32 nColor = 0; if ( Value >>= nColor ) { - Color aColor = Color( nColor ); + Color aColor( nColor ); pWindow->SetTextColor( aColor ); pWindow->SetControlForeground( aColor ); } @@ -1677,7 +1677,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& sal_Int32 nColor = 0; if ( Value >>= nColor ) { - Color aColor = Color( nColor ); + Color aColor( nColor ); pWindow->SetTextLineColor( aColor ); } } @@ -1690,7 +1690,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& sal_Int32 nColor = 0; if ( Value >>= nColor ) { - Color aColor = Color( nColor ); + Color aColor( nColor ); pWindow->SetFillColor( aColor ); } } @@ -1703,7 +1703,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& sal_Int32 nColor = 0; if ( Value >>= nColor ) { - Color aColor = Color( nColor ); + Color aColor( nColor ); pWindow->SetLineColor( aColor ); } } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index b25cdce8acba..e13b535ea4d0 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -123,7 +123,7 @@ namespace toolkit // for the real background (everything except the buttons and the thumb), // use an average between the desired color and "white" Color aWhite( COL_WHITE ); - Color aBackground = Color( nBackgroundColor ); + Color aBackground( nBackgroundColor ); aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 ); aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 ); aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 ); @@ -132,19 +132,19 @@ namespace toolkit sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance(); sal_Int32 nWhiteLuminance = COL_WHITE.GetLuminance(); - Color aLightShadow = Color( nBackgroundColor ); + Color aLightShadow( nBackgroundColor ); aLightShadow.IncreaseLuminance( static_cast<sal_uInt8>( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) ); aStyleSettings.SetLightBorderColor( aLightShadow ); - Color aLight = Color( nBackgroundColor ); + Color aLight( nBackgroundColor ); aLight.IncreaseLuminance( static_cast<sal_uInt8>( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) ); aStyleSettings.SetLightColor( aLight ); - Color aShadow = Color( nBackgroundColor ); + Color aShadow( nBackgroundColor ); aShadow.DecreaseLuminance( static_cast<sal_uInt8>( nBackgroundLuminance * 1 / 3 ) ); aStyleSettings.SetShadowColor( aShadow ); - Color aDarkShadow = Color( nBackgroundColor ); + Color aDarkShadow( nBackgroundColor ); aDarkShadow.DecreaseLuminance( static_cast<sal_uInt8>( nBackgroundLuminance * 2 / 3 ) ); aStyleSettings.SetDarkShadowColor( aDarkShadow ); } diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx index b9dff4bfee53..fbd29c4efa4f 100644 --- a/toolkit/source/helper/accessibilityclient.cxx +++ b/toolkit/source/helper/accessibilityclient.cxx @@ -172,8 +172,7 @@ namespace toolkit s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 ); if ( s_hAccessibleImplementationModule != nullptr ) { - const OUString sFactoryCreationFunc = - OUString("getStandardAccessibleFactory"); + const OUString sFactoryCreationFunc("getStandardAccessibleFactory"); s_pAccessibleFactoryFunc = reinterpret_cast<GetStandardAccComponentFactory>( osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData )); diff --git a/tools/source/xml/XmlWalker.cxx b/tools/source/xml/XmlWalker.cxx index ca5c2c96eb2b..736cd07edeba 100644 --- a/tools/source/xml/XmlWalker.cxx +++ b/tools/source/xml/XmlWalker.cxx @@ -93,7 +93,7 @@ OString XmlWalker::attribute(const OString& sName) { xmlChar* xmlName = xmlCharStrdup(sName.getStr()); xmlChar* xmlAttribute = xmlGetProp(mpImpl->mpCurrent, xmlName); - OString aAttributeContent = OString(reinterpret_cast<const char*>(xmlAttribute)); + OString aAttributeContent(reinterpret_cast<const char*>(xmlAttribute)); xmlFree(xmlAttribute); xmlFree(xmlName); diff --git a/writerfilter/source/dmapper/LoggedResources.cxx b/writerfilter/source/dmapper/LoggedResources.cxx index fa11d8430e12..e12aaae36fb3 100644 --- a/writerfilter/source/dmapper/LoggedResources.cxx +++ b/writerfilter/source/dmapper/LoggedResources.cxx @@ -185,10 +185,7 @@ void LoggedStream::utext(const sal_uInt8 * data, size_t len) mHelper.startElement("utext"); mHelper.startElement("data"); - OUString sText; - OUStringBuffer aBuffer = OUStringBuffer(sal::static_int_cast<int>(len)); - aBuffer.append( reinterpret_cast<const sal_Unicode *>(data), len); - sText = aBuffer.makeStringAndClear(); + OUString sText( reinterpret_cast<const sal_Unicode *>(data), len); LoggedResourcesHelper::chars(sText); diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 325e06feac8c..32be860859c0 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -773,8 +773,7 @@ TVChildTarget::getHierAccess( const Reference< XMultiServiceFactory >& sProvider if( sProvider.is() ) { Sequence< Any > seq(1); - OUString sReaderService = - OUString( "com.sun.star.configuration.ConfigurationAccess" ); + OUString sReaderService( "com.sun.star.configuration.ConfigurationAccess" ); seq[0] <<= OUString::createFromAscii( file ); diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx index a1d4200214e5..4b14a35e0251 100644 --- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx @@ -138,7 +138,7 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl: m_Entries[i].Type = ExtAltNameType_REGISTERED_ID; - OString nssOid = OString(CERT_GetOidString(¤t->name.other)); + OString nssOid(CERT_GetOidString(¤t->name.other)); OString unoOid = removeOIDFromString(nssOid); m_Entries[i].Value <<= OStringToOUString( unoOid, RTL_TEXTENCODING_ASCII_US ); break; |