Kaydet (Commit) b52f309f authored tarafından Noel Grandin's avatar Noel Grandin

improve loplugin simplifyconstruct

to find stuff like
   OUString s = OUString("xxx")

Change-Id: Ie7ed074c1ae012734c67a2a89c564c1900a4ab04
Reviewed-on: https://gerrit.libreoffice.org/70697
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 897493fb
......@@ -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 );
}
......
......@@ -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()
)
......
......@@ -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));
}
}
......
......@@ -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() );
......
......@@ -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() );
......
......@@ -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
......
......@@ -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
......
......@@ -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();
......
......@@ -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 ))
......
......@@ -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);
}
......
......@@ -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: */
......@@ -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 );
}
......
......@@ -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;
......
......@@ -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]);
......
......@@ -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) );
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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:
......
......@@ -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 )
{
......
......@@ -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#
......
......@@ -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;
......
......@@ -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))
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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 )
{
......
......@@ -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())
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
......@@ -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!" );
......
......@@ -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 &&
......
......@@ -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++ ]) );
......
......@@ -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;
......
......@@ -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
......
......@@ -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), "");
}
}
......
......@@ -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)
{
......
......@@ -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" );
......
......@@ -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 };
......
......@@ -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);
......
......@@ -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
......
......@@ -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,
......
......@@ -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);
}
}
......
......@@ -2167,7 +2167,7 @@ void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor )