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) for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
{ {
OUString aName(c); OUString aName = OUString(c) + ".txt";
aName += ".txt";
uno::Reference<io::XInputStream> xStrm; uno::Reference<io::XInputStream> xStrm;
mxNA->getByName(aName) >>= xStrm; mxNA->getByName(aName) >>= xStrm;
@ -175,8 +174,7 @@ namespace
for (char c = 'a'; c <= 'z'; ++c, ++itBuf) for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
{ {
OUString aName(c); OUString aName = OUString(c) + ".txt";
aName += ".txt";
uno::Reference<io::XInputStream> xStrm; uno::Reference<io::XInputStream> xStrm;
//Size of each stream is 1mb (>10000) => XBufferedThreadedStream //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() if ( aIter != aNamespaces.end()
&& ( aIter->second == MANIFEST_NAMESPACE || aIter->second == MANIFEST_OASIS_NAMESPACE ) ) { && ( 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 // no check for manifest.xml consistency currently since the old versions have supported inconsistent documents as well
aResult = MANIFEST_NSPREFIX; aResult = MANIFEST_NSPREFIX + aPureName;
aResult += aPureName;
} }
return aResult; 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 ) if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN )
throw io::IOException(); // TODO: throw io::IOException(); // TODO:
OUString aOrigRelStreamName = aOrigStreamName; OUString aOrigRelStreamName = aOrigStreamName + ".rels";
aOrigRelStreamName += ".rels"; OUString aNewRelStreamName = aNewStreamName + ".rels";
OUString aNewRelStreamName = aNewStreamName;
aNewRelStreamName += ".rels";
bool bRenamed = aOrigRelStreamName != aNewRelStreamName; bool bRenamed = aOrigRelStreamName != aNewRelStreamName;
if ( m_nRelInfoStatus == RELINFO_CHANGED 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() ) if ( m_nStorageType == embed::StorageFormats::OFOPXML && m_xRelStorage.is() )
{ {
OUString aRelStreamName = aOriginalName; OUString aRelStreamName = aOriginalName + ".rels";
aRelStreamName += ".rels";
if ( m_xRelStorage->hasByName( aRelStreamName ) ) if ( m_xRelStorage->hasByName( aRelStreamName ) )
m_xRelStorage->removeElement( aRelStreamName ); m_xRelStorage->removeElement( aRelStreamName );
@ -1654,8 +1653,7 @@ uno::Reference< io::XInputStream > OStorage_Impl::GetRelInfoStreamForName( const
ReadContents(); ReadContents();
if ( m_xRelStorage.is() ) if ( m_xRelStorage.is() )
{ {
OUString aRelStreamName = aName; OUString aRelStreamName = aName + ".rels";
aRelStreamName += ".rels";
if ( m_xRelStorage->hasByName( aRelStreamName ) ) if ( m_xRelStorage->hasByName( aRelStreamName ) )
{ {
uno::Reference< io::XStream > xStream = m_xRelStorage->openStreamElement( aRelStreamName, embed::ElementModes::READ ); 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; accessMode = storeAccessMode::ReadOnly;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -288,8 +287,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
return RegError::INVALID_VALUE; return RegError::INVALID_VALUE;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -355,8 +353,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const *
return RegError::REGISTRY_READONLY; return RegError::REGISTRY_READONLY;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -411,8 +408,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
return RegError::REGISTRY_READONLY; return RegError::REGISTRY_READONLY;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -476,8 +472,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
return RegError::REGISTRY_READONLY; return RegError::REGISTRY_READONLY;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -544,8 +539,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
accessMode = storeAccessMode::ReadOnly; accessMode = storeAccessMode::ReadOnly;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -630,8 +624,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue
accessMode = storeAccessMode::ReadOnly; accessMode = storeAccessMode::ReadOnly;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -734,8 +727,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal
accessMode = storeAccessMode::ReadOnly; accessMode = storeAccessMode::ReadOnly;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);
@ -832,8 +824,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
accessMode = storeAccessMode::ReadOnly; accessMode = storeAccessMode::ReadOnly;
} }
OUString sImplValueName( VALUE_PREFIX ); OUString sImplValueName = VALUE_PREFIX + valueName;
sImplValueName += valueName;
REG_GUARD(m_pRegistry->m_mutex); REG_GUARD(m_pRegistry->m_mutex);

View File

@ -796,8 +796,7 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
return _ret; return _ret;
} }
OUString tmpName(sRelativKey); OUString tmpName = sRelativKey + ROOT;
tmpName += ROOT;
OStoreFile sFile(pKey->getStoreFile()); OStoreFile sFile(pKey->getStoreFile());
if (sFile.isValid() && sFile.remove(sFullPath, tmpName)) if (sFile.isValid() && sFile.remove(sFullPath, tmpName))
@ -1198,8 +1197,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
if (sRelPath.getLength() > 1 || sFullPath.isEmpty()) if (sRelPath.getLength() > 1 || sFullPath.isEmpty())
sFullPath += ROOT; sFullPath += ROOT;
OUString sFullKeyName = sFullPath; OUString sFullKeyName = sFullPath + keyName;
sFullKeyName += keyName;
OStoreDirectory rStoreDir; OStoreDirectory rStoreDir;
if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, storeAccessMode::Create)) 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, "\"\""); sExpression = sExpression.replaceAt(nIndex, 1, "\"\"");
nIndex = sExpression.indexOf('"',nIndex+2); nIndex = sExpression.indexOf('"',nIndex+2);
} }
OUString sFormula("rpt:HASCHANGED(\"");
TGroupFunctionMap::const_iterator aGroupFind = m_aGroupFunctionMap.find(xGroup); TGroupFunctionMap::const_iterator aGroupFind = m_aGroupFunctionMap.find(xGroup);
if ( aGroupFind != m_aGroupFunctionMap.end() ) if ( aGroupFind != m_aGroupFunctionMap.end() )
sExpression = aGroupFind->second->getName(); sExpression = aGroupFind->second->getName();
sFormula += sExpression; sExpression = "rpt:HASCHANGED(\"" + sExpression + "\")";
sFormula += "\")";
sExpression = sFormula;
} }
AddAttribute(XML_NAMESPACE_REPORT, XML_SORT_EXPRESSION, sField); AddAttribute(XML_NAMESPACE_REPORT, XML_SORT_EXPRESSION, sField);
AddAttribute(XML_NAMESPACE_REPORT, XML_GROUP_EXPRESSION,sExpression); AddAttribute(XML_NAMESPACE_REPORT, XML_GROUP_EXPRESSION,sExpression);
@ -1556,10 +1553,7 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG
xFunction->setName(sFunctionName); xFunction->setName(sFunctionName);
if ( !sInitialFormula.isEmpty() ) if ( !sInitialFormula.isEmpty() )
xFunction->setInitialFormula(beans::Optional< OUString>(true, sInitialFormula)); xFunction->setInitialFormula(beans::Optional< OUString>(true, sInitialFormula));
sFunction = "rpt:" + sFunction; sFunction = "rpt:" + sFunction + "([" + sExpression + "]";
sFunction += "([";
sFunction += sExpression;
sFunction += "]";
if ( !sPrefix.isEmpty() ) if ( !sPrefix.isEmpty() )
sFunction += sPrefix; sFunction += sPrefix;

View File

@ -2157,8 +2157,7 @@ void GeometryHandler::impl_setCounterFunction_throw()
{ {
OUString sNamePostfix; OUString sNamePostfix;
fillScope_throw(sNamePostfix); fillScope_throw(sNamePostfix);
OUString sFunctionName = m_aCounterFunction.m_sName; OUString sFunctionName = m_aCounterFunction.m_sName + sNamePostfix;
sFunctionName += sNamePostfix;
const OUString sQuotedFunctionName = lcl_getQuotedFunctionName(sFunctionName); const OUString sQuotedFunctionName = lcl_getQuotedFunctionName(sFunctionName);
OUString sScope; OUString sScope;
if ( !(!sFunctionName.isEmpty() && m_aFunctionNames.find(sQuotedFunctionName) != m_aFunctionNames.end() && impl_isCounterFunction_throw(sQuotedFunctionName,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"); OSL_ENSURE(_xGroup.is(),"Group is NULL -> GPF");
if ( _xGroup->getHeaderOn() && _xGroup->getHeader()->getName().isEmpty() ) if ( _xGroup->getHeaderOn() && _xGroup->getHeader()->getName().isEmpty() )
{ {
OUString sName = RptResId(RID_STR_GROUPHEADER); OUString sName = RptResId(RID_STR_GROUPHEADER) + OUString::number(_nPos);
sName += OUString::number(_nPos);
_xGroup->getHeader()->setName(sName); _xGroup->getHeader()->setName(sName);
} }
if ( _xGroup->getFooterOn() && _xGroup->getFooter()->getName().isEmpty() ) if ( _xGroup->getFooterOn() && _xGroup->getFooter()->getName().isEmpty() )
{ {
OUString sName = RptResId(RID_STR_GROUPFOOTER); OUString sName = RptResId(RID_STR_GROUPFOOTER) + OUString::number(_nPos);
sName += OUString::number(_nPos);
_xGroup->getFooter()->setName(sName); _xGroup->getFooter()->setName(sName);
} }
} }

View File

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

View File

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

View File

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

View File

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