[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang dbaccess/source drawinglayer/source emfio/source extensions/source filter/source include/rtl l10ntools/source oox/source sal/qa scripting/source sc/source sdext/source sd/qa sw/qa sw/source unodevtools/source vbahelper/source xmloff/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Nov 11 05:34:23 UTC 2020
compilerplugins/clang/test/xmlimport.cxx | 32 +++++++
compilerplugins/clang/xmlimport.cxx | 81 +++++++++++++++++++
dbaccess/source/ui/dlg/dbwizsetup.cxx | 6 -
drawinglayer/source/tools/emfpfont.cxx | 11 +-
drawinglayer/source/tools/emfphelperdata.cxx | 8 -
drawinglayer/source/tools/emfppen.cxx | 31 +++----
drawinglayer/source/tools/emfpstringformat.cxx | 43 +++++-----
emfio/source/reader/emfreader.cxx | 2
extensions/source/ole/oleobjw.cxx | 2
filter/source/msfilter/mstoolbar.cxx | 2
include/rtl/string.hxx | 2
include/rtl/ustring.hxx | 2
l10ntools/source/localize.cxx | 6 -
oox/source/vml/vmldrawing.cxx | 2
sal/qa/osl/file/osl_File.cxx | 24 ++---
sc/source/filter/excel/xestream.cxx | 2
sc/source/ui/vba/vbaeventshelper.cxx | 8 -
scripting/source/dlgprov/dlgevtatt.cxx | 2
scripting/source/protocolhandler/scripthandler.cxx | 5 -
scripting/source/provider/URIHelper.cxx | 4
scripting/source/vbaevents/eventhelper.cxx | 3
sd/qa/unit/tiledrendering/tiledrendering.cxx | 2
sdext/source/minimizer/informationdialog.cxx | 2
sdext/source/minimizer/optimizerdialogcontrols.cxx | 2
sw/qa/extras/tiledrendering/tiledrendering.cxx | 2
sw/source/ui/vba/vbaoptions.cxx | 2
unodevtools/source/skeletonmaker/cppcompskeleton.cxx | 2
vbahelper/source/msforms/vbauserform.cxx | 2
xmloff/source/text/txtfldi.cxx | 2
29 files changed, 204 insertions(+), 90 deletions(-)
New commits:
commit cc1e6ee2dd4609c27cb7a09aa47a779592a3e22c
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Nov 10 14:41:56 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 11 06:33:40 2020 +0100
disable O(U)String::concat for internal code
in favour of the more widely used, and better optimised, operator+
Change-Id: I6a1b37e0f3d253af1f7a0892443f59b620efea63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105523
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 1dd342c12401..473c0d32ca34 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -751,7 +751,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
createUniqueFolderName(&aDBPathURL);
sUrl = aDBPathURL.GetMainURL( INetURLObject::DecodeMechanism::NONE);
xSimpleFileAccess->createFolder(sUrl);
- sUrl = eType.concat(sUrl);
+ sUrl = eType + sUrl;
}
m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, sUrl));
m_pImpl->saveChanges(*m_pOutSet);
@@ -817,7 +817,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
if (bFolderExists)
{
i++;
- pURL->setName(sLastSegmentName.concat(OUString::number(i)));
+ pURL->setName(sLastSegmentName + OUString::number(i));
}
}
}
@@ -835,7 +835,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
bElementExists = xSimpleFileAccess->exists( aExistenceCheck.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
if ( bElementExists )
{
- aExistenceCheck.setBase( BaseName.concat( OUString::number( i ) ) );
+ aExistenceCheck.setBase( BaseName + OUString::number( i ) );
++i;
}
}
diff --git a/drawinglayer/source/tools/emfpfont.cxx b/drawinglayer/source/tools/emfpfont.cxx
index f641fdd4d21b..609135460992 100644
--- a/drawinglayer/source/tools/emfpfont.cxx
+++ b/drawinglayer/source/tools/emfpfont.cxx
@@ -18,27 +18,28 @@
*/
#include <sal/log.hxx>
+#include <rtl/ustrbuf.hxx>
#include "emfpfont.hxx"
namespace emfplushelper
{
static OUString FontStyleToString(sal_uInt32 style)
{
- OUString sStyle;
+ OUStringBuffer sStyle;
if (style & FontStyleBold)
sStyle = "\n\t\t\tFontStyleBold";
if (style & FontStyleItalic)
- sStyle = sStyle.concat("\n\t\t\tFontStyleItalic");
+ sStyle.append("\n\t\t\tFontStyleItalic");
if (style & FontStyleUnderline)
- sStyle = sStyle.concat("\n\t\t\tFontStyleUnderline");
+ sStyle.append("\n\t\t\tFontStyleUnderline");
if (style & FontStyleStrikeout)
- sStyle = sStyle.concat("\n\t\t\tFontStyleStrikeout");
+ sStyle.append("\n\t\t\tFontStyleStrikeout");
- return sStyle;
+ return sStyle.makeStringAndClear();
}
void EMFPFont::Read(SvMemoryStream &s)
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index d9aed087885f..f486d59375fd 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -214,14 +214,10 @@ namespace emfplushelper
static OUString BrushIDToString(sal_uInt16 flags, sal_uInt32 brushid)
{
- OUString sBrushId;
-
if (IsBrush(flags))
- sBrushId = sBrushId.concat("EmfPlusBrush ID: ").concat(OUString::number(brushid));
+ return "EmfPlusBrush ID: " + OUString::number(brushid);
else
- sBrushId = sBrushId.concat("ARGB: 0x").concat(OUString::number(brushid, 16));
-
- return sBrushId;
+ return "ARGB: 0x" + OUString::number(brushid, 16);
}
EMFPObject::~EMFPObject()
diff --git a/drawinglayer/source/tools/emfppen.cxx b/drawinglayer/source/tools/emfppen.cxx
index c5e7d457be61..60500b6bf7ec 100644
--- a/drawinglayer/source/tools/emfppen.cxx
+++ b/drawinglayer/source/tools/emfppen.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/rendering/PathJoinType.hpp>
#include <o3tl/safeint.hxx>
#include <sal/log.hxx>
+#include <rtl/ustrbuf.hxx>
#include "emfppen.hxx"
#include "emfpcustomlinecap.hxx"
@@ -75,48 +76,48 @@ namespace emfplushelper
static OUString PenDataFlagsToString(sal_uInt32 flags)
{
- OUString sFlags;
+ rtl::OUStringBuffer sFlags;
if (flags & EmfPlusPenDataTransform)
- sFlags = "\nEMF+\t\t\tEmfPlusPenDataTransform";
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataTransform");
if (flags & EmfPlusPenDataStartCap)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataStartCap");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataStartCap");
if (flags & EmfPlusPenDataEndCap)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataEndCap");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataEndCap");
if (flags & EmfPlusPenDataJoin)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataJoin");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataJoin");
if (flags & EmfPlusPenDataMiterLimit)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataMiterLimit");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataMiterLimit");
if (flags & EmfPlusPenDataLineStyle)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataLineStyle");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataLineStyle");
if (flags & EmfPlusPenDataDashedLineCap)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataDashedLineCap");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataDashedLineCap");
if (flags & EmfPlusPenDataDashedLineOffset)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataDashedLineOffset");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataDashedLineOffset");
if (flags & EmfPlusPenDataDashedLine)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataDashedLine");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataDashedLine");
if (flags & EmfPlusPenDataAlignment)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataAlignment");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataAlignment");
if (flags & EmfPlusPenDataCompoundLine)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataCompoundLine");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataCompoundLine");
if (flags & EmfPlusPenDataCustomStartCap)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataCustomStartCap");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataCustomStartCap");
if (flags & EmfPlusPenDataCustomEndCap)
- sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataCustomEndCap");
+ sFlags.append("\nEMF+\t\t\tEmfPlusPenDataCustomEndCap");
- return sFlags;
+ return sFlags.makeStringAndClear();
}
static OUString LineCapTypeToString(sal_uInt32 linecap)
diff --git a/drawinglayer/source/tools/emfpstringformat.cxx b/drawinglayer/source/tools/emfpstringformat.cxx
index ad08f14a21be..a523ab80e531 100644
--- a/drawinglayer/source/tools/emfpstringformat.cxx
+++ b/drawinglayer/source/tools/emfpstringformat.cxx
@@ -18,6 +18,7 @@
*/
#include <sal/log.hxx>
+#include <rtl/ustrbuf.hxx>
#include "emfpstringformat.hxx"
namespace emfplushelper
@@ -43,78 +44,78 @@ namespace emfplushelper
static OUString StringFormatFlags(sal_uInt32 flag)
{
- OUString sFlags;
+ OUStringBuffer sFlags;
if (flag & StringFormatDirectionRightToLeft)
- sFlags = sFlags.concat("StringFormatDirectionRightToLeft");
+ sFlags.append("StringFormatDirectionRightToLeft");
if (flag & StringFormatDirectionRightToLeft)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatDirectionRightToLeft");
+ sFlags.append("StringFormatDirectionRightToLeft");
}
if (flag & StringFormatNoFitBlackBox)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatNoFitBlackBox");
+ sFlags.append("StringFormatNoFitBlackBox");
}
if (flag & StringFormatDisplayFormatControl)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatDisplayFormatControl");
+ sFlags.append("StringFormatDisplayFormatControl");
}
if (flag & StringFormatNoFontFallback)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatNoFontFallback");
+ sFlags.append("StringFormatNoFontFallback");
}
if (flag & StringFormatMeasureTrailingSpaces)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatMeasureTrailingSpaces");
+ sFlags.append("StringFormatMeasureTrailingSpaces");
}
if (flag & StringFormatNoWrap)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatNoWrap");
+ sFlags.append("StringFormatNoWrap");
}
if (flag & StringFormatLineLimit)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatLineLimit");
+ sFlags.append("StringFormatLineLimit");
}
if (flag & StringFormatNoClip)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatNoClip");
+ sFlags.append("StringFormatNoClip");
}
if (flag & StringFormatBypassGDI)
{
if (!sFlags.isEmpty())
- sFlags = sFlags.concat(", ");
+ sFlags.append(", ");
- sFlags = sFlags.concat("StringFormatBypassGDI");
+ sFlags.append("StringFormatBypassGDI");
}
- return sFlags;
+ return sFlags.makeStringAndClear();
}
static OUString StringAlignmentString(sal_uInt32 nAlignment)
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 1bc6339ff897..5f396bf2244a 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -422,7 +422,7 @@ namespace emfio
break;
sal_Unicode cUniChar = static_cast<sal_Unicode>(cChar);
- aDesc = aDesc.concat(OUString(cUniChar));
+ aDesc = aDesc + OUStringChar(cUniChar);
}
SAL_INFO("emfio", "\t\tDescription: " << aDesc);
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index bde55278c174..532794f3992d 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -472,7 +472,7 @@ Any SAL_CALL IUnknownWrapper::getValue( const OUString& aPropertyName )
if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, nullptr, nullptr, nullptr ) ) )
{
OUString sLibName( o3tl::toU(LPCOLESTR(sName)));
- m_sTypeName = sLibName.concat( "." ).concat( sTmp );
+ m_sTypeName = sLibName + "." + sTmp;
}
}
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 441b60c3ca98..336eed1b59ef 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -488,7 +488,7 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
if ( aMacroInf.mbFound )
aProp.Value = CustomToolBarImportHelper::createCommandFromMacro( aMacroInf.msResolvedMacro );
else
- aProp.Value <<= OUString( "UnResolvedMacro[" ).concat( extraInfo.getOnAction() ).concat( "]" );
+ aProp.Value <<= "UnResolvedMacro[" + extraInfo.getOnAction() + "]";
sControlData.push_back( aProp );
}
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index d9422c696059..be78e199c412 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -1393,6 +1393,7 @@ public:
return OString( pNew, SAL_NO_ACQUIRE );
}
+#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
/**
Concatenates the specified string to the end of this string.
@@ -1407,6 +1408,7 @@ public:
rtl_string_newConcat( &pNew, pData, str.pData );
return OString( pNew, SAL_NO_ACQUIRE );
}
+#endif
#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
friend OString operator+( const OString & str1, const OString & str2 )
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 707bbf6e66d6..f3006847de1e 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -2300,6 +2300,7 @@ public:
return OUString( pNew, SAL_NO_ACQUIRE );
}
+#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
/**
Concatenates the specified string to the end of this string.
@@ -2314,6 +2315,7 @@ public:
rtl_uString_newConcat( &pNew, pData, str.pData );
return OUString( pNew, SAL_NO_ACQUIRE );
}
+#endif
#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
friend OUString operator+( const OUString& rStr1, const OUString& rStr2 )
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index 35fc924a0813..e069ba6f5a5c 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -211,7 +211,7 @@ bool handleFile(const OString& rProject, const OUString& rUrl, const OString& rP
if (commands[i].executable == "uiex" || commands[i].executable == "hrcex")
sOutPath = gDestRoot + "/" + rProject + "/messages.pot";
else
- sOutPath = rPotDir.concat(".pot");
+ sOutPath = rPotDir + ".pot";
if (!fileExists(sOutPath))
InitPoFile(rProject, sInPath, rPotDir, sOutPath);
@@ -363,11 +363,11 @@ void handleDirectory(
{
case 0: // a root directory
if (stat.getFileType() == osl::FileStatus::Directory && includeProject(sDirName))
- aSubDirs[stat.getFileURL()][sDirName] = rPotDir.concat("/").concat(sDirName);
+ aSubDirs[stat.getFileURL()][sDirName] = rPotDir + "/" + sDirName;
break;
default:
if (stat.getFileType() == osl::FileStatus::Directory)
- aSubDirs[stat.getFileURL()][rProject] = rPotDir.concat("/").concat(sDirName);
+ aSubDirs[stat.getFileURL()][rProject] = rPotDir + "/" + sDirName;
else
aFileNames.push_back(stat.getFileURL());
break;
diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index cc24d1f10468..716b07dc6e61 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -189,7 +189,7 @@ void Drawing::convertAndInsert() const
}
for ( const auto& BoxItr : GroupBoxMap )
{
- const uno::Any aGroup( OUString("autoGroup_").concat(BoxItr.first) );
+ const uno::Any aGroup( "autoGroup_" + BoxItr.first );
for ( auto RadioItr = RadioButtonMap.begin(); RadioItr != RadioButtonMap.end(); )
{
if ( BoxItr.second.IsInside(RadioItr->second) )
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 32eafc2f6db2..42c7a18a4f11 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -478,25 +478,25 @@ namespace osl_FileBase
void getAbsoluteFileURL::getAbsoluteFileURL_001_1()
{
- OUString suAssume = aUserDirectoryURL.concat("/relative/file1");
+ OUString suAssume = aUserDirectoryURL + "/relative/file1";
check_getAbsoluteFileURL(aUserDirectoryURL, "relative/file1",osl::FileBase::E_None, suAssume);
}
void getAbsoluteFileURL::getAbsoluteFileURL_001_2()
{
- OUString suAssume = aUserDirectoryURL.concat("/relative/file2");
+ OUString suAssume = aUserDirectoryURL + "/relative/file2";
check_getAbsoluteFileURL(aUserDirectoryURL, "relative/./file2",osl::FileBase::E_None, suAssume);
}
void getAbsoluteFileURL::getAbsoluteFileURL_001_3()
{
- OUString suAssume = aUserDirectoryURL.concat("/file3");
+ OUString suAssume = aUserDirectoryURL + "/file3";
check_getAbsoluteFileURL(aUserDirectoryURL, "relative/../file3",osl::FileBase::E_None, suAssume);
}
void getAbsoluteFileURL::getAbsoluteFileURL_001_4()
{
- OUString suAssume = aUserDirectoryURL.concat("/file4");
+ OUString suAssume = aUserDirectoryURL + "/file4";
check_getAbsoluteFileURL(aUserDirectoryURL, "././relative/../file4",osl::FileBase::E_None, suAssume);
}
@@ -504,16 +504,16 @@ namespace osl_FileBase
{
OUString suAssume;
#if (defined UNX)
- suAssume = aUserDirectoryURL.concat("/relative/");
+ suAssume = aUserDirectoryURL + "/relative/";
#else
- suAssume = aUserDirectoryURL.concat("/relative");
+ suAssume = aUserDirectoryURL + "/relative";
#endif
check_getAbsoluteFileURL(aUserDirectoryURL, "././relative/.",osl::FileBase::E_None, suAssume);
}
void getAbsoluteFileURL::getAbsoluteFileURL_001_6()
{
- OUString suAssume = aUserDirectoryURL.concat("/.relative");
+ OUString suAssume = aUserDirectoryURL + "/.relative";
check_getAbsoluteFileURL(aUserDirectoryURL, "./.relative",osl::FileBase::E_None, suAssume);
}
@@ -521,16 +521,16 @@ namespace osl_FileBase
{
OUString suAssume;
#if (defined UNX)
- suAssume = aUserDirectoryURL.concat("/.a/");
+ suAssume = aUserDirectoryURL + "/.a/";
#else // windows
- suAssume = aUserDirectoryURL.concat("/.a");
+ suAssume = aUserDirectoryURL + "/.a";
#endif
check_getAbsoluteFileURL(aUserDirectoryURL, "./.a/mydir/..",osl::FileBase::E_None, suAssume);
}
void getAbsoluteFileURL::getAbsoluteFileURL_001_8()
{
- OUString suAssume = aUserDirectoryURL.concat("/tmp/ok");
+ OUString suAssume = aUserDirectoryURL + "/tmp/ok";
#if (defined UNX)
check_getAbsoluteFileURL(aUserDirectoryURL, "tmp//ok",osl::FileBase::E_None, suAssume);
#else
@@ -553,7 +553,7 @@ namespace osl_FileBase
sal_Int32 fd = symlink(strSrcFileName.getStr(), strLinkFileName.getStr());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), fd);
OString sLnkURL = OUStringToOString(aLnkURL1, RTL_TEXTENCODING_ASCII_US);
- OUString suAssume = aUserDirectoryURL.concat("/canonical.name");
+ OUString suAssume = aUserDirectoryURL + "/canonical.name";
check_getAbsoluteFileURL(aUserDirectoryURL, sLnkURL, osl::FileBase::E_None, suAssume);
deleteTestFile(aCanURL1);
fd = remove(strLinkFileName.getStr());
@@ -574,7 +574,7 @@ namespace osl_FileBase
OUString aUStrBase = aUserDirectoryURL + "/test1/dir1";
createTestDirectory(aUStrBase);
- OUString suAssume = aUserDirectoryURL.concat("/mytestfile");
+ OUString suAssume = aUserDirectoryURL + "/mytestfile";
check_getAbsoluteFileURL(aUStrBase, "../../mytestfile" , osl::FileBase::E_None, suAssume);
deleteTestDirectory(aUStrBase);
deleteTestDirectory(aUStrUpBase);
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 78f03e2176a6..7f434dd44fc4 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1179,7 +1179,7 @@ void XclExpXmlStream::validateTabNames(std::vector<OUString>& aOriginalTabNames)
for (int i=rangeStart; i<rangeEnd && aNewName.isEmpty(); i++)
{
- aNewName = rOriginalName.copy(0, MAX_TAB_NAME_LENGTH - 1 - digits).concat("-").concat(OUString::number(i));
+ aNewName = rOriginalName.copy(0, MAX_TAB_NAME_LENGTH - 1 - digits) + "-" + OUString::number(i);
if (aNewTabNames.end() != std::find(aNewTabNames.begin(), aNewTabNames.end(), aNewName) ||
aOriginalTabNames.end() != std::find(aOriginalTabNames.begin(), aOriginalTabNames.end(), aNewName))
{
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index 536423a957ca..7f70942dadae 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -530,13 +530,13 @@ ScVbaEventsHelper::ScVbaEventsHelper( const uno::Sequence< uno::Any >& rArgs ) :
// global
auto registerAutoEvent = [this](sal_Int32 nID, const char* sName)
- { registerEventHandler(nID, script::ModuleType::NORMAL, (OString("Auto_").concat(sName)).getStr(), -1, uno::Any(false)); };
+ { registerEventHandler(nID, script::ModuleType::NORMAL, OString(OStringLiteral("Auto_") + sName).getStr(), -1, uno::Any(false)); };
registerAutoEvent(AUTO_OPEN, "Open");
registerAutoEvent(AUTO_CLOSE, "Close");
// Workbook
auto registerWorkbookEvent = [this](sal_Int32 nID, const char* sName, sal_Int32 nCancelIndex)
- { registerEventHandler(nID, script::ModuleType::DOCUMENT, (OString("Workbook_").concat(sName)).getStr(), nCancelIndex, uno::Any(false)); };
+ { registerEventHandler(nID, script::ModuleType::DOCUMENT, OString(OStringLiteral("Workbook_") + sName).getStr(), nCancelIndex, uno::Any(false)); };
registerWorkbookEvent( WORKBOOK_ACTIVATE, "Activate", -1 );
registerWorkbookEvent( WORKBOOK_DEACTIVATE, "Deactivate", -1 );
registerWorkbookEvent( WORKBOOK_OPEN, "Open", -1 );
@@ -552,10 +552,10 @@ ScVbaEventsHelper::ScVbaEventsHelper( const uno::Sequence< uno::Any >& rArgs ) :
// Worksheet events. All events have a corresponding workbook event.
auto registerWorksheetEvent = [this](sal_Int32 nID, const char* sName, sal_Int32 nCancelIndex)
{
- registerEventHandler(nID, script::ModuleType::DOCUMENT, (OString("Worksheet_").concat(sName)).getStr(),
+ registerEventHandler(nID, script::ModuleType::DOCUMENT, OString(OStringLiteral("Worksheet_") + sName).getStr(),
nCancelIndex, uno::Any(true));
registerEventHandler(USERDEFINED_START + nID, script::ModuleType::DOCUMENT,
- (OString("Workbook_Worksheet").concat(sName)).getStr(),
+ OString(OStringLiteral("Workbook_Worksheet") + sName).getStr(),
((nCancelIndex >= 0) ? (nCancelIndex + 1) : -1), uno::Any(false));
};
registerWorksheetEvent( WORKSHEET_ACTIVATE, "Activate", -1 );
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index 4f5970a49bee..b91ffc3c3a31 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -139,7 +139,7 @@ namespace dlgprov
return;
ScriptEvent aScriptEventCopy( aScriptEvent );
- aScriptEventCopy.ScriptCode = msDialogLibName.concat( "." ).concat( msDialogCodeName );
+ aScriptEventCopy.ScriptCode = msDialogLibName + "." + msDialogCodeName;
try
{
mxListener->firing( aScriptEventCopy );
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index 78d754300cfa..b163a2000cce 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -242,9 +242,8 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
{
aException = ::cppu::getCaughtException();
- OUString reason = "ScriptProtocolHandler::dispatch: caught ";
-
- invokeResult <<= reason.concat( aException.getValueTypeName() ).concat( ": " ).concat( e.Message );
+ invokeResult <<= "ScriptProtocolHandler::dispatch: caught "
+ + aException.getValueTypeName() + ": " + e.Message;
bCaughtException = true;
}
diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx
index f6d2f65a672b..09fedf5762fd 100644
--- a/scripting/source/provider/URIHelper.cxx
+++ b/scripting/source/provider/URIHelper.cxx
@@ -127,7 +127,7 @@ ScriptingFrameworkURIHelper::initBaseURI()
}
else if (m_sLocation.startsWith("vnd.sun.star.tdoc"))
{
- m_sBaseURI = m_sLocation.concat( SCRIPTS_PART );
+ m_sBaseURI = m_sLocation + SCRIPTS_PART;
m_sLocation = "document";
return true;
}
@@ -153,7 +153,7 @@ ScriptingFrameworkURIHelper::initBaseURI()
{
if ( bAppendScriptsPart )
{
- m_sBaseURI = pChild->concat( SCRIPTS_PART );
+ m_sBaseURI = *pChild + SCRIPTS_PART;
}
else
{
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 31e7a1bf80d2..c4404839ee4a 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -877,10 +877,9 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet )
break;
}
- OUString sTemp = sName.concat( rTxInfo.sVBAName );
// see if we have a match for the handlerextension
// where ScriptCode is methodname_handlerextension
- OUString sToResolve = sMacroLoc.concat( sTemp );
+ OUString sToResolve = sMacroLoc + sName + rTxInfo.sVBAName;
ooo::vba::MacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve );
if ( aMacroResolvedInfo.mbFound )
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index b71e91b6b820..d03e1be8341e 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -2155,7 +2155,7 @@ void SdTiledRenderingTest::testIMESupport()
ESelection aWordSelection(0, 0, 0, 3); // start para, start char, end para, end char.
rEditView.SetSelection(aWordSelection);
// content contains only the last IME composition, not all
- CPPUNIT_ASSERT_EQUAL(OUString("x").concat(aInputs[aInputs.size() - 1]), rEditView.GetSelected());
+ CPPUNIT_ASSERT_EQUAL(OUString("x" + aInputs[aInputs.size() - 1]), rEditView.GetSelected());
}
void SdTiledRenderingTest::testTdf115783()
diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx
index 8ab6ddfbd8cf..736802475167 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -260,7 +260,7 @@ void InformationDialog::InitDialog()
xURLTransformer->parseSmart( aURL, OUString() );
const OUString sFileProtocol( "file:///" );
- aPresentationURL.Complete = sFileProtocol.concat( aURL.Name );
+ aPresentationURL.Complete = sFileProtocol + aURL.Name;
aTitle = xURLTransformer->getPresentation( aPresentationURL, false );
if ( aTitle.match( sFileProtocol ) )
diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx b/sdext/source/minimizer/optimizerdialogcontrols.cxx
index 13fe926dd36e..79832c36fb2f 100644
--- a/sdext/source/minimizer/optimizerdialogcontrols.cxx
+++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx
@@ -853,7 +853,7 @@ void OptimizerDialog::InitPage4()
const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
do
{
- OUString aTemp( aDefault.concat( OUString::number( nSession++ ) ) );
+ OUString aTemp = aDefault + OUString::number( nSession++ );
for ( i = 1; i < rList.size(); i++ )
{
if ( rList[ i ].maName == aTemp )
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 0b790648d50c..9f8f074a4568 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -2177,7 +2177,7 @@ void SwTiledRenderingTest::testIMESupport()
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), pShellCursor->GetPoint()->nContent.GetIndex());
// content contains only the last IME composition, not all
- CPPUNIT_ASSERT_EQUAL(aInputs[aInputs.size() - 1].concat("Aaa bbb."), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+ CPPUNIT_ASSERT_EQUAL(OUString(aInputs[aInputs.size() - 1] + "Aaa bbb."), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
}
void SwTiledRenderingTest::testSplitNodeRedlineCallback()
diff --git a/sw/source/ui/vba/vbaoptions.cxx b/sw/source/ui/vba/vbaoptions.cxx
index 7fd79bd6ca80..dd3cb2227435 100644
--- a/sw/source/ui/vba/vbaoptions.cxx
+++ b/sw/source/ui/vba/vbaoptions.cxx
@@ -103,7 +103,7 @@ void SwVbaOptions::setValueEvent( const uno::Any& value )
sal_Int32 nIndex = sOldPathUrl.lastIndexOf( ';' );
if( nIndex != -1 )
{
- sNewPathUrl = sOldPathUrl.copy( 0, nIndex + 1 ).concat( sNewPathUrl );
+ sNewPathUrl = sOldPathUrl.copy( 0, nIndex + 1 ) + sNewPathUrl;
}
xPathSettings->setPropertyValue( msDefaultFilePath, uno::makeAny( sNewPathUrl ) );
}
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
index b1fc3ac33035..3bbcee31dbf7 100644
--- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
@@ -860,7 +860,7 @@ static void generateMethodBodies(std::ostream& o,
OString const & comphelpernamespace,
OUString const & propertyhelper)
{
- OString name(classname.concat("::"));
+ OString name = classname + "::";
codemaker::GeneratedTypeSet generated;
for (const auto& rIface : interfaces) {
if ( rIface == "com.sun.star.lang.XServiceInfo" ) {
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 8f3c158c4e5a..c82a84fd1035 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -256,7 +256,7 @@ ScVbaUserForm::getValue( const OUString& aPropertyName )
uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() );
ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
if (pControl && !m_sLibName.isEmpty())
- pControl->setLibraryAndCodeName( m_sLibName.concat( "." ).concat( getName() ) );
+ pControl->setLibraryAndCodeName( m_sLibName + "." + getName() );
aResult <<= xVBAControl;
}
}
commit dfb2e07e32694c220e791574b7a6c05f5648c0c2
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Nov 10 14:53:01 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 11 06:33:32 2020 +0100
loplugin:xmlimport add more checks
to find places where the slowparser -> fastparser conversion
work is incomplete, fixing one bug in the process.
Change-Id: Ifd0d801d71eee0aaf25287fbac1a4237a811e7c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105511
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/test/xmlimport.cxx b/compilerplugins/clang/test/xmlimport.cxx
index 98dba400b19e..d2fb23a69c78 100644
--- a/compilerplugins/clang/test/xmlimport.cxx
+++ b/compilerplugins/clang/test/xmlimport.cxx
@@ -192,4 +192,36 @@ public:
virtual SvXMLImportContextRef CreateChildContext() override { return nullptr; }
};
+enum XmlTokens
+{
+ XML_TOK_1
+};
+
+void test20(sal_uInt32 p, sal_uInt16 q, XmlTokens e)
+{
+ // expected-error at +1 {{comparing XML_TOK enum to 'sal_uInt32', expected sal_uInt16 [loplugin:xmlimport]}}
+ if (p == XML_TOK_1)
+ ;
+ // no warning expected
+ if (q == XML_TOK_1)
+ ;
+ switch (p)
+ {
+ // expected-error at +1 {{comparing XML_TOK enum to 'sal_uInt32', expected sal_uInt16 [loplugin:xmlimport]}}
+ case XML_TOK_1:
+ break;
+ }
+ switch (q)
+ {
+ // no warning expected
+ case XML_TOK_1:
+ break;
+ }
+ switch (e)
+ {
+ // no warning expected
+ case XML_TOK_1:
+ break;
+ }
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/xmlimport.cxx b/compilerplugins/clang/xmlimport.cxx
index f9e5659d71c0..e01f387e0c74 100644
--- a/compilerplugins/clang/xmlimport.cxx
+++ b/compilerplugins/clang/xmlimport.cxx
@@ -71,8 +71,13 @@ public:
bool VisitCXXMethodDecl(const CXXMethodDecl*);
bool VisitCXXMemberCallExpr(const CXXMemberCallExpr*);
+ bool VisitBinaryOperator(const BinaryOperator*);
+ bool VisitSwitchStmt(const SwitchStmt*);
private:
+ bool isXmlTokEnum(const Expr*);
+ bool isUInt16(const Expr*);
+
std::unordered_map<const CXXRecordDecl*, const CXXMethodDecl*> startFastElementSet;
std::unordered_map<const CXXRecordDecl*, const CXXMethodDecl*> StartElementSet;
std::unordered_map<const CXXRecordDecl*, const CXXMethodDecl*> endFastElementSet;
@@ -259,6 +264,82 @@ bool XmlImport::VisitCXXMemberCallExpr(const CXXMemberCallExpr* callExpr)
return true;
}
+bool XmlImport::VisitBinaryOperator(const BinaryOperator* binaryOp)
+{
+ auto beginLoc = compat::getBeginLoc(binaryOp);
+ if (!beginLoc.isValid() || ignoreLocation(binaryOp))
+ return true;
+ auto op = binaryOp->getOpcode();
+ if (op != BO_EQ && op != BO_NE)
+ return true;
+ auto check2 = [&](const Expr* expr) -> void {
+ if (!isUInt16(expr))
+ report(DiagnosticsEngine::Warning,
+ "comparing XML_TOK enum to 'sal_uInt32', expected sal_uInt16",
+ compat::getBeginLoc(binaryOp))
+ << binaryOp->getSourceRange();
+ };
+ if (isXmlTokEnum(binaryOp->getLHS()))
+ check2(binaryOp->getRHS());
+ else if (isXmlTokEnum(binaryOp->getRHS()))
+ check2(binaryOp->getLHS());
+ return true;
+}
+
+bool XmlImport::VisitSwitchStmt(const SwitchStmt* switchStmt)
+{
+ auto beginLoc = compat::getBeginLoc(switchStmt);
+ if (!beginLoc.isValid() || ignoreLocation(switchStmt))
+ return true;
+ if (isUInt16(switchStmt->getCond()))
+ return true;
+ // if the condition is an enum type, ignore this switch
+ auto condEnumType = compat::IgnoreImplicit(switchStmt->getCond())
+ ->getType()
+ ->getUnqualifiedDesugaredType()
+ ->getAs<EnumType>();
+ if (condEnumType)
+ return true;
+ auto switchCaseStmt = switchStmt->getSwitchCaseList();
+ for (; switchCaseStmt != nullptr; switchCaseStmt = switchCaseStmt->getNextSwitchCase())
+ {
+ auto caseStmt = dyn_cast<CaseStmt>(switchCaseStmt);
+ if (!caseStmt)
+ continue;
+ if (!isXmlTokEnum(caseStmt->getLHS()))
+ continue;
+ report(DiagnosticsEngine::Warning,
+ "comparing XML_TOK enum to 'sal_uInt32', expected sal_uInt16",
+ compat::getBeginLoc(caseStmt))
+ << caseStmt->getSourceRange();
+ }
+ return true;
+}
+
+bool XmlImport::isXmlTokEnum(const Expr* expr)
+{
+ expr = compat::IgnoreImplicit(expr);
+ // check that we have an unscoped enum type
+ auto condEnumType = expr->getType()->getUnqualifiedDesugaredType()->getAs<EnumType>();
+ if (!condEnumType || condEnumType->getDecl()->isScoped())
+ return false;
+ auto declRefExpr = dyn_cast<DeclRefExpr>(expr);
+ if (!declRefExpr)
+ return false;
+ auto enumConstant = dyn_cast<EnumConstantDecl>(declRefExpr->getDecl());
+ if (!enumConstant)
+ return false;
+ return enumConstant->getIdentifier() && enumConstant->getName().startswith("XML_TOK_");
+}
+
+bool XmlImport::isUInt16(const Expr* expr)
+{
+ expr = compat::IgnoreImplicit(expr);
+ if (expr->getType()->isSpecificBuiltinType(BuiltinType::UShort))
+ return true;
+ return bool(loplugin::TypeCheck(expr->getType()).Typedef("sal_uInt16"));
+}
+
loplugin::Plugin::Registration<XmlImport> xmlimport("xmlimport");
} // namespace
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 6612f86dbe92..58f0d08c46b9 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -3700,7 +3700,7 @@ void XMLDropDownFieldImportContext::ProcessAttribute(
sHelp = sAttrValue;
bHelpOK = true;
}
- else if (nAttrToken == XML_TOK_TEXTFIELD_HINT)
+ else if (nAttrToken == XML_ELEMENT(TEXT, XML_HINT))
{
sHint = sAttrValue;
bHintOK = true;
More information about the Libreoffice-commits
mailing list