loplugin:stringadd in package..sax

Change-Id: I1f8b626ae99bca6e31e7c4aa9c8a1fc016b76e5c
Reviewed-on: https://gerrit.libreoffice.org/79890
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2019-09-30 15:11:25 +02:00
parent 46c2a3688c
commit b74c4b7c67
13 changed files with 61 additions and 91 deletions

View File

@ -152,8 +152,7 @@ namespace
for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
{
OUString aName(c);
aName += ".txt";
OUString aName = OUString(c) + ".txt";
uno::Reference<io::XInputStream> xStrm;
mxNA->getByName(aName) >>= xStrm;
@ -175,8 +174,7 @@ namespace
for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
{
OUString aName(c);
aName += ".txt";
OUString aName = OUString(c) + ".txt";
uno::Reference<io::XInputStream> xStrm;
//Size of each stream is 1mb (>10000) => XBufferedThreadedStream

View File

@ -581,8 +581,7 @@ OUString ManifestImport::ConvertNameWithNamespace( const OUString& aName, const
if ( aIter != aNamespaces.end()
&& ( aIter->second == MANIFEST_NAMESPACE || aIter->second == MANIFEST_OASIS_NAMESPACE ) ) {
// no check for manifest.xml consistency currently since the old versions have supported inconsistent documents as well
aResult = MANIFEST_NSPREFIX;
aResult += aPureName;
aResult = MANIFEST_NSPREFIX + aPureName;
}
return aResult;

View File

@ -1510,11 +1510,8 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora
if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN )
throw io::IOException(); // TODO:
OUString aOrigRelStreamName = aOrigStreamName;
aOrigRelStreamName += ".rels";
OUString aNewRelStreamName = aNewStreamName;
aNewRelStreamName += ".rels";
OUString aOrigRelStreamName = aOrigStreamName + ".rels";
OUString aNewRelStreamName = aNewStreamName + ".rels";
bool bRenamed = aOrigRelStreamName != aNewRelStreamName;
if ( m_nRelInfoStatus == RELINFO_CHANGED

View File

@ -1591,8 +1591,7 @@ void OStorage_Impl::RemoveStreamRelInfo( const OUString& aOriginalName )
if ( m_nStorageType == embed::StorageFormats::OFOPXML && m_xRelStorage.is() )
{
OUString aRelStreamName = aOriginalName;
aRelStreamName += ".rels";
OUString aRelStreamName = aOriginalName + ".rels";
if ( m_xRelStorage->hasByName( aRelStreamName ) )
m_xRelStorage->removeElement( aRelStreamName );
@ -1654,8 +1653,7 @@ uno::Reference< io::XInputStream > OStorage_Impl::GetRelInfoStreamForName( const
ReadContents();
if ( m_xRelStorage.is() )
{
OUString aRelStreamName = aName;
aRelStreamName += ".rels";
OUString aRelStreamName = aName + ".rels";
if ( m_xRelStorage->hasByName( aRelStreamName ) )
{
uno::Reference< io::XStream > xStream = m_xRelStorage->openStreamElement( aRelStreamName, embed::ElementModes::READ );

View File

@ -228,8 +228,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy
accessMode = storeAccessMode::ReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -288,8 +287,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
return RegError::INVALID_VALUE;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -355,8 +353,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const *
return RegError::REGISTRY_READONLY;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -411,8 +408,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
return RegError::REGISTRY_READONLY;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -476,8 +472,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
return RegError::REGISTRY_READONLY;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -544,8 +539,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
accessMode = storeAccessMode::ReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -630,8 +624,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue
accessMode = storeAccessMode::ReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -734,8 +727,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal
accessMode = storeAccessMode::ReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);
@ -832,8 +824,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
accessMode = storeAccessMode::ReadOnly;
}
OUString sImplValueName( VALUE_PREFIX );
sImplValueName += valueName;
OUString sImplValueName = VALUE_PREFIX + valueName;
REG_GUARD(m_pRegistry->m_mutex);

View File

@ -796,8 +796,7 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
return _ret;
}
OUString tmpName(sRelativKey);
tmpName += ROOT;
OUString tmpName = sRelativKey + ROOT;
OStoreFile sFile(pKey->getStoreFile());
if (sFile.isValid() && sFile.remove(sFullPath, tmpName))
@ -1198,8 +1197,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
if (sRelPath.getLength() > 1 || sFullPath.isEmpty())
sFullPath += ROOT;
OUString sFullKeyName = sFullPath;
sFullKeyName += keyName;
OUString sFullKeyName = sFullPath + keyName;
OStoreDirectory rStoreDir;
if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, storeAccessMode::Create))

View File

@ -1082,14 +1082,11 @@ void ORptExport::exportGroup(const Reference<XReportDefinition>& _xReportDefinit
sExpression = sExpression.replaceAt(nIndex, 1, "\"\"");
nIndex = sExpression.indexOf('"',nIndex+2);
}
OUString sFormula("rpt:HASCHANGED(\"");
TGroupFunctionMap::const_iterator aGroupFind = m_aGroupFunctionMap.find(xGroup);
if ( aGroupFind != m_aGroupFunctionMap.end() )
sExpression = aGroupFind->second->getName();
sFormula += sExpression;
sFormula += "\")";
sExpression = sFormula;
sExpression = "rpt:HASCHANGED(\"" + sExpression + "\")";
}
AddAttribute(XML_NAMESPACE_REPORT, XML_SORT_EXPRESSION, sField);
AddAttribute(XML_NAMESPACE_REPORT, XML_GROUP_EXPRESSION,sExpression);
@ -1556,10 +1553,7 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG
xFunction->setName(sFunctionName);
if ( !sInitialFormula.isEmpty() )
xFunction->setInitialFormula(beans::Optional< OUString>(true, sInitialFormula));
sFunction = "rpt:" + sFunction;
sFunction += "([";
sFunction += sExpression;
sFunction += "]";
sFunction = "rpt:" + sFunction + "([" + sExpression + "]";
if ( !sPrefix.isEmpty() )
sFunction += sPrefix;

View File

@ -2157,8 +2157,7 @@ void GeometryHandler::impl_setCounterFunction_throw()
{
OUString sNamePostfix;
fillScope_throw(sNamePostfix);
OUString sFunctionName = m_aCounterFunction.m_sName;
sFunctionName += sNamePostfix;
OUString sFunctionName = m_aCounterFunction.m_sName + sNamePostfix;
const OUString sQuotedFunctionName = lcl_getQuotedFunctionName(sFunctionName);
OUString sScope;
if ( !(!sFunctionName.isEmpty() && m_aFunctionNames.find(sQuotedFunctionName) != m_aFunctionNames.end() && impl_isCounterFunction_throw(sQuotedFunctionName,sScope)) )

View File

@ -162,15 +162,13 @@ void adjustSectionName(const uno::Reference< report::XGroup >& _xGroup,sal_Int32
OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF");
if ( _xGroup->getHeaderOn() && _xGroup->getHeader()->getName().isEmpty() )
{
OUString sName = RptResId(RID_STR_GROUPHEADER);
sName += OUString::number(_nPos);
OUString sName = RptResId(RID_STR_GROUPHEADER) + OUString::number(_nPos);
_xGroup->getHeader()->setName(sName);
}
if ( _xGroup->getFooterOn() && _xGroup->getFooter()->getName().isEmpty() )
{
OUString sName = RptResId(RID_STR_GROUPFOOTER);
sName += OUString::number(_nPos);
OUString sName = RptResId(RID_STR_GROUPFOOTER) + OUString::number(_nPos);
_xGroup->getFooter()->setName(sName);
}
}

View File

@ -389,8 +389,8 @@ OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterfac
}
else // multiselection
{
aName = RptResId(RID_STR_BRWTITLE_PROPERTIES);
aName += RptResId(RID_STR_BRWTITLE_MULTISELECT);
aName = RptResId(RID_STR_BRWTITLE_PROPERTIES)
+ RptResId(RID_STR_BRWTITLE_MULTISELECT);
}
return aName;

View File

@ -86,10 +86,9 @@ static OString errorToString(const osl::FileBase::RC _nError)
static OString errorToStr(osl::FileBase::RC const& nError)
{
OString suBuf;
suBuf += "The returned error is: " ;
suBuf += errorToString(nError);
suBuf += "!\n";
OString suBuf = "The returned error is: " +
errorToString(nError) +
"!\n";
return suBuf;
}
@ -263,8 +262,8 @@ static void deleteTestDirectory(const OUString& dirname)
nError = Directory::remove(aPathURL);
OString strError ("In deleteTestDirectory function: remove Directory ");
strError += OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US);
OString strError = OString("In deleteTestDirectory function: remove Directory ") +
OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US);
CPPUNIT_ASSERT_MESSAGE(strError.getStr(), (osl::FileBase::E_None == nError) || (nError == osl::FileBase::E_NOENT));
}
@ -368,16 +367,15 @@ static bool checkDirectory(const OUString& str, oslCheckMode nCheckMode)
*/
static OString outputError(const OString & returnVal, const OString & rightVal, const sal_Char * msg = "")
{
OString aString;
if (returnVal == rightVal)
return aString;
return OString();
aString += msg;
aString += ": the returned value is '";
aString += returnVal;
aString += "', but the value should be '";
aString += rightVal;
aString += "'.";
OString aString = OString(msg) +
": the returned value is '" +
returnVal +
"', but the value should be '" +
rightVal +
"'.";
return aString;
}
@ -969,9 +967,9 @@ namespace osl_FileBase
bool bOk = compareFileName(aUStr, aUResultURL);
OString sError("test for getSystemPathFromFileURL(' ");
sError += OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US);
sError += " ') function:use an absolute file URL, ";
OString sError = "test for getSystemPathFromFileURL(' " +
OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) +
" ') function:use an absolute file URL, ";
sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US),
OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US));
@ -992,9 +990,9 @@ namespace osl_FileBase
bool bOk = compareFileName(aUStr, aUResultURL);
OString sError("test for getSystemPathFromFileURL(' ");
sError += OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US);
sError += " ') function:use a CJK coded absolute URL, ";
OString sError = "test for getSystemPathFromFileURL(' " +
OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) +
" ') function:use a CJK coded absolute URL, ";
sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US),
OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US));
deleteTestDirectory(aTmpName10);
@ -4773,9 +4771,9 @@ namespace osl_Directory
CPPUNIT_ASSERT_EQUAL_MESSAGE("temp File removal failed", osl::FileBase::E_None, nError1);
nError1 = Directory::create(aTmpDir);
OString sError("test for create function: create a directory '");
sError += OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US);
sError += "' and check its existence.";
OString sError = "test for create function: create a directory '" +
OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US) +
"' and check its existence.";
CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_None, nError1);
osl_setFileAttributes(aTmpDir.pData, 0); // no access allowed now
@ -4789,9 +4787,9 @@ namespace osl_Directory
osl_File_Attribute_OwnWrite |
osl_File_Attribute_OwnExe);
deleteTestDirectory(aTmpDir);
sError = OString("test for create function: create a directory under '");
sError += OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US);
sError += "' for access test.";
sError = OString("test for create function: create a directory under '") +
OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US) +
"' for access test.";
CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_ACCES, nError1);
#endif
}
@ -4888,8 +4886,8 @@ namespace osl_Directory
nError1 = Directory::remove(aTmpName3);
deleteTestFile(aTmpName4);
deleteTestDirectory(aTmpName3);
OString sError = "test for remove function: try to remove a directory that is not empty.";
sError += errorToStr(nError1).getStr();
OString sError = "test for remove function: try to remove a directory that is not empty." +
errorToStr(nError1);
#if defined(__sun)
// on UNX, the implementation uses rmdir(), which EEXIST is thrown on Solaris when the directory is not empty, refer to: 'man -s 2 rmdir', while on linux, ENOTEMPTY is thrown.
// EEXIST The directory contains entries other than those for "." and "..".

View File

@ -43,9 +43,9 @@ public:
File tmp_file(aTmpFile);
err = tmp_file.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create);
OString sErrorMsg = "Expected that '";
sErrorMsg += OUStringToOString(aTmpFile, RTL_TEXTENCODING_ASCII_US);
sErrorMsg += "' would exist!";
OString sErrorMsg = "Expected that '" +
OUStringToOString(aTmpFile, RTL_TEXTENCODING_ASCII_US) +
"' would exist!";
CPPUNIT_ASSERT_EQUAL_MESSAGE(sErrorMsg.getStr(), FileBase::E_EXIST, err);
char buffer[1];

View File

@ -614,13 +614,13 @@ OUString getErrorMessage( XML_Error xmlE, const OUString& sSystemId , sal_Int32
Message = "not standalone";
}
OUString str("[");
str += sSystemId;
str += " line ";
str += OUString::number( nLine );
str += "]: ";
str += Message;
str += "error";
OUString str = "[" +
sSystemId +
" line " +
OUString::number( nLine ) +
"]: " +
Message +
"error";
return str;
}