summaryrefslogtreecommitdiff
path: root/ucb/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 10:23:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 13:36:11 +0000
commit6ffdcbdd29f014fcce290dfdb969fb6ff66a95ed (patch)
treede79b16c883e1176729afb7bef4485d00f52faa3 /ucb/source
parent04ed7cbe53243a042ceeecc62212e73a910d7aef (diff)
loplugin:stringadd in ucb
when applying my upcoming patch to also consider O[U]StringBuffer Change-Id: I2445a69dc46314c73f54c190a0c498c0309be06b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149750 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source')
-rw-r--r--ucb/source/core/ucb.cxx15
-rw-r--r--ucb/source/core/ucbstore.cxx3
-rw-r--r--ucb/source/regexp/regexp.cxx6
-rw-r--r--ucb/source/ucp/ext/ucpext_provider.cxx6
-rw-r--r--ucb/source/ucp/ftp/ftpurl.cxx7
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydata.cxx6
-rw-r--r--ucb/source/ucp/inc/urihelper.hxx10
-rw-r--r--ucb/source/ucp/tdoc/tdoc_content.cxx10
-rw-r--r--ucb/source/ucp/webdav-curl/CurlSession.cxx6
-rw-r--r--ucb/source/ucp/webdav-curl/CurlUri.cxx7
-rw-r--r--ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx13
11 files changed, 28 insertions, 61 deletions
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 26476a90562b..27c49c229c75 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -78,24 +78,21 @@ bool fillPlaceholders(OUString const & rInput,
&& p[0] == 'a' && p[1] == 'm' && p[2] == 'p'
&& p[3] == ';')
{
- aBuffer.append(pCopy, p - 1 - pCopy);
- aBuffer.append('&');
+ aBuffer.append(OUString::Concat(std::u16string_view(pCopy, p - 1 - pCopy)) + "&");
p += 4;
pCopy = p;
}
else if (pEnd - p >= 3
&& p[0] == 'l' && p[1] == 't' && p[2] == ';')
{
- aBuffer.append(pCopy, p - 1 - pCopy);
- aBuffer.append('<');
+ aBuffer.append(OUString::Concat(std::u16string_view(pCopy, p - 1 - pCopy)) + "<");
p += 3;
pCopy = p;
}
else if (pEnd - p >= 3
&& p[0] == 'g' && p[1] == 't' && p[2] == ';')
{
- aBuffer.append(pCopy, p - 1 - pCopy);
- aBuffer.append('>');
+ aBuffer.append(OUString::Concat(std::u16string_view(pCopy, p - 1 - pCopy)) + ">");
p += 3;
pCopy = p;
}
@@ -124,8 +121,7 @@ bool fillPlaceholders(OUString const & rInput,
}
if (!bFound)
return false;
- aBuffer.append(pCopy, p - 1 - pCopy);
- aBuffer.append(aValue);
+ aBuffer.append(std::u16string_view(pCopy, p - 1 - pCopy) + aValue);
p = q + 1;
pCopy = p;
break;
@@ -827,8 +823,7 @@ bool UniversalContentBroker::getContentProviderData(
ContentProviderData aInfo;
- OUStringBuffer aElemBuffer;
- aElemBuffer.append( "['" );
+ OUStringBuffer aElemBuffer( "['" );
makeAndAppendXMLName( aElemBuffer, rElem );
aElemBuffer.append( "']" );
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index 7a090788f776..882e0773ddd6 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -61,8 +61,7 @@ using namespace cppu;
static OUString makeHierarchalNameSegment( std::u16string_view rIn )
{
- OUStringBuffer aBuffer;
- aBuffer.append( "['" );
+ OUStringBuffer aBuffer( "['" );
size_t nCount = rIn.size();
for ( size_t n = 0; n < nCount; ++n )
diff --git a/ucb/source/regexp/regexp.cxx b/ucb/source/regexp/regexp.cxx
index 0eeac4a4a80f..8b8dcbc85b8f 100644
--- a/ucb/source/regexp/regexp.cxx
+++ b/ucb/source/regexp/regexp.cxx
@@ -189,8 +189,7 @@ OUString Regexp::getRegexp() const
break;
case KIND_DOMAIN:
- aBuffer.append("([^/?#]");
- aBuffer.append(sal_Unicode(m_bEmptyDomain ? '*' : '+'));
+ aBuffer.append("([^/?#]" + OUStringChar(sal_Unicode(m_bEmptyDomain ? '*' : '+')));
if (!m_aInfix.isEmpty())
appendStringLiteral(&aBuffer, m_aInfix);
aBuffer.append("([/?#].*)?)");
@@ -220,8 +219,7 @@ OUString Regexp::getRegexp() const
break;
case KIND_DOMAIN:
- aBuffer.append("[^/?#]");
- aBuffer.append( m_bEmptyDomain ? '*' : '+' );
+ aBuffer.append("[^/?#]" + OUStringChar( m_bEmptyDomain ? '*' : '+' ));
if (!m_aInfix.isEmpty())
appendStringLiteral(&aBuffer, m_aInfix);
aBuffer.append("([/?#].*)?");
diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx
index 765ea7856517..faf96540675a 100644
--- a/ucb/source/ucp/ext/ucpext_provider.cxx
+++ b/ucb/source/ucp/ext/ucpext_provider.cxx
@@ -101,8 +101,7 @@ namespace ucb::ucp::ext
const OUString sIdentifier( i_rIdentifier->getContentIdentifier() );
// the scheme needs to be lower-case
- OUStringBuffer aComposer;
- aComposer.append( sIdentifier.copy( 0, sScheme.getLength() ).toAsciiLowerCase() );
+ OUStringBuffer aComposer( sIdentifier.copy( 0, sScheme.getLength() ).toAsciiLowerCase() );
// one : is required after the scheme
std::u16string_view sRemaining( sIdentifier.subView( sScheme.getLength() ) );
@@ -121,8 +120,7 @@ namespace ucb::ucp::ext
{
if ( sRemaining[0] != '/' )
{
- aComposer.append( '/' );
- aComposer.append( sRemaining );
+ aComposer.append( OUString::Concat("/") + sRemaining );
}
else
{
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index 09f88e4db952..e36341ae18ac 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -243,8 +243,7 @@ OUString FTPURL::ident(bool withslash,bool internal) const
// and more important, as one without username and
// password. ( These are set together with the command. )
- OUStringBuffer bff;
- bff.append("ftp://");
+ OUStringBuffer bff("ftp://");
if( m_aUsername != "anonymous" ) {
bff.append(m_aUsername);
@@ -285,9 +284,7 @@ OUString FTPURL::ident(bool withslash,bool internal) const
OUString FTPURL::parent(bool internal) const
{
- OUStringBuffer bff;
-
- bff.append("ftp://");
+ OUStringBuffer bff("ftp://");
if( m_aUsername != "anonymous" ) {
bff.append(m_aUsername);
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx
index c209f9bcf72c..25547182b683 100644
--- a/ucb/source/ucp/hierarchy/hierarchydata.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx
@@ -929,8 +929,7 @@ OUString HierarchyEntry::createPathFromHierarchyURL(
if ( nLen )
{
- OUStringBuffer aNewPath;
- aNewPath.append( "['" );
+ OUStringBuffer aNewPath( "['" );
sal_Int32 nStart = 0;
sal_Int32 nEnd = aPath.indexOf( '/' );
@@ -1028,8 +1027,7 @@ const HierarchyEntryData& HierarchyEntry::iterator::operator*()
{
try
{
- OUStringBuffer aKey;
- aKey.append( "['" );
+ OUStringBuffer aKey( "['" );
makeXMLName( names.getConstArray()[ pos ], aKey );
aKey.append( "']" );
diff --git a/ucb/source/ucp/inc/urihelper.hxx b/ucb/source/ucp/inc/urihelper.hxx
index 5e89aba5ca5b..fa9c7c918151 100644
--- a/ucb/source/ucp/inc/urihelper.hxx
+++ b/ucb/source/ucp/inc/urihelper.hxx
@@ -94,16 +94,10 @@ namespace ucb_impl::urihelper {
while ( nIndex >= 0 );
if ( !aParams.isEmpty() )
- {
- aResult.append( u'?' );
- aResult.append( aParams );
- }
+ aResult.append( u"?" + aParams );
if ( !aFragment.isEmpty() )
- {
- aResult.append( u'#' );
- aResult.append( aFragment );
- }
+ aResult.append( u"#" + aFragment );
return aResult.makeStringAndClear();
}
diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx
index 03c80a2ad756..5bc1f79ffb59 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.cxx
@@ -1590,10 +1590,7 @@ void Content::insert( const uno::Reference< io::XInputStream >& xData,
do
{
- OUStringBuffer aNew(aNewUri.getUri());
- aNew.append( "_" );
- aNew.append( ++nTry );
- aNewUri.setUri( aNew.makeStringAndClear() );
+ aNewUri.setUri( aNewUri.getUri() + "_" + OUString::number(++nTry) );
}
while ( hasData( aNewUri ) && ( nTry < 1000 ) );
@@ -1610,10 +1607,7 @@ void Content::insert( const uno::Reference< io::XInputStream >& xData,
}
else
{
- OUStringBuffer aNewTitle(m_aProps.getTitle());
- aNewTitle.append( "_" );
- aNewTitle.append( ++nTry );
- m_aProps.setTitle( aNewTitle.makeStringAndClear() );
+ m_aProps.setTitle( m_aProps.getTitle() + "_" + OUString::number( ++nTry ) );
}
}
break;
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index bb1d4689a53c..8071301f261d 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -1348,9 +1348,9 @@ auto CurlProcessor::ProcessRequest(
{
static char const hexDigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- buf.append("\\x");
- buf.append(hexDigit[static_cast<sal_uInt8>(bytes[i]) >> 4]);
- buf.append(hexDigit[bytes[i] & 0x0F]);
+ buf.append(OString::Concat("\\x")
+ + OStringChar(hexDigit[static_cast<sal_uInt8>(bytes[i]) >> 4])
+ + OStringChar(hexDigit[bytes[i] & 0x0F]));
}
else
{
diff --git a/ucb/source/ucp/webdav-curl/CurlUri.cxx b/ucb/source/ucp/webdav-curl/CurlUri.cxx
index 073a173a8352..c5440423a2db 100644
--- a/ucb/source/ucp/webdav-curl/CurlUri.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlUri.cxx
@@ -307,9 +307,7 @@ OUString ConnectionEndPointString(std::u16string_view rHostName, sal_uInt16 cons
// Is host a numeric IPv6 address?
if ((rHostName.find(':') != std::u16string_view::npos) && (rHostName[0] != '['))
{
- aBuf.append("[");
- aBuf.append(rHostName);
- aBuf.append("]");
+ aBuf.append(OUString::Concat("[") + rHostName + "]");
}
else
{
@@ -318,8 +316,7 @@ OUString ConnectionEndPointString(std::u16string_view rHostName, sal_uInt16 cons
if ((nPort != DEFAULT_HTTP_PORT) && (nPort != DEFAULT_HTTPS_PORT))
{
- aBuf.append(":");
- aBuf.append(sal_Int32(nPort));
+ aBuf.append(":" + OUString::number(sal_Int32(nPort)));
}
return aBuf.makeStringAndClear();
}
diff --git a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
index b129872a78b3..4b7f7786eb8b 100644
--- a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
@@ -47,13 +47,12 @@ auto DumpResources(std::vector<DAVResource> const& rResources) -> OUString
OUStringBuffer buf;
for (auto const& rResource : rResources)
{
- buf.append("resource URL: <");
- buf.append(rResource.uri);
+ buf.append("resource URL: <" + rResource.uri);
try {
CurlUri const uri(rResource.uri);
- buf.append("> parsed URL: <");
- buf.append(DecodeURI(uri.GetRelativeReference()));
- buf.append("> ");
+ buf.append("> parsed URL: <"
+ + DecodeURI(uri.GetRelativeReference())
+ + "> ");
} catch (...) {
// parsing uri could fail
buf.append("> parsing URL failed! ");
@@ -61,9 +60,7 @@ auto DumpResources(std::vector<DAVResource> const& rResources) -> OUString
buf.append("properties: ");
for (auto const& it : rResource.properties)
{
- buf.append("\"");
- buf.append(it.Name);
- buf.append("\" ");
+ buf.append("\"" + it.Name + "\" ");
}
buf.append("\n");
}