loplugin:stringview

Add new methods "subView" to O(U)String to return substring views
of the underlying data.

Add a clang plugin to warn when replacing existing calls to copy()
would be better to use subView().

Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel
2020-11-11 11:58:37 +01:00
committed by Noel Grandin
parent 1fde62018c
commit 93c64a61f2
142 changed files with 581 additions and 220 deletions
+1 -1
View File
@@ -1678,7 +1678,7 @@ bool checkUnoObjectType(SbUnoObject& rUnoObj, const OUString& rClass)
sal_Int32 nClassNameDot = rClass.lastIndexOf( '.' );
if( nClassNameDot >= 0 )
{
aClassName += rClass.copy( 0, nClassNameDot + 1 ) + "X" + rClass.copy( nClassNameDot + 1 );
aClassName += OUString::Concat(rClass.subView( 0, nClassNameDot + 1 )) + "X" + rClass.subView( nClassNameDot + 1 );
}
else
{
+1 -1
View File
@@ -1471,7 +1471,7 @@ void SbRtl_Str(StarBASIC *, SbxArray & rPar, bool)
{
iZeroSearch += 1;
}
aStrNew += aStr.copy(iZeroSearch);
aStrNew += aStr.subView(iZeroSearch);
}
else
{
+1 -1
View File
@@ -120,7 +120,7 @@ protected:
OUString sFileName = m_sTestFileName;
assert(sFileName.lastIndexOf('.') < sFileName.getLength());
sFileName = sFileName.copy(0, sFileName.lastIndexOf('.')) + ".txt";
sFileName = OUString::Concat(sFileName.subView(0, sFileName.lastIndexOf('.'))) + ".txt";
if (!m_bDumpMode)
{
if (m_aReferenceFile.is_open())
+1 -1
View File
@@ -424,7 +424,7 @@ awt::Size lcl_placeLegendEntries(
ShapeFactory* pShapeFactory = ShapeFactory::getOrCreateShapeFactory(xShapeFactory);
for (sal_Int32 nNewLen = aLabelString.getLength() - sDots.getLength(); nNewLen > 0; nNewLen--)
{
OUString aNewLabel = aLabelString.copy(0, nNewLen) + sDots;
OUString aNewLabel = aLabelString.subView(0, nNewLen) + sDots;
Reference<drawing::XShape> xEntry = pShapeFactory->createText(
xTarget, aNewLabel, rTextProperties.first, rTextProperties.second, uno::Any());
nSumHeight = xEntry->getSize().Height;
+2 -2
View File
@@ -1791,7 +1791,7 @@ void handleExceptionType(
addExceptionBaseArguments(
manager, dependencies, &desc2, code.get(), entity->getDirectBase(),
&index3);
code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/Throwable;" + desc2.getDescriptor().copy(1));
code->instrInvokespecial(superClass, "<init>", OString::Concat("(Ljava/lang/Throwable;") + desc2.getDescriptor().subView(1));
}
sal_uInt16 maxSize2 = index3;
if (baseRuntimeException) {
@@ -1817,7 +1817,7 @@ void handleExceptionType(
code->instrReturn();
code->setMaxStackAndLocals(maxSize2, index3);
cf->addMethod(
ClassFile::ACC_PUBLIC, "<init>", "(Ljava/lang/Throwable;" + desc2.getDescriptor().copy(1), code.get(),
ClassFile::ACC_PUBLIC, "<init>", OString::Concat("(Ljava/lang/Throwable;") + desc2.getDescriptor().subView(1), code.get(),
std::vector< OString >(), desc2.getSignature());
addTypeInfo(className, typeInfo, dependencies, cf.get());
+1 -1
View File
@@ -613,7 +613,7 @@ bool OStorageHelper::PathHasSegment( const OUString& aPath, const OUString& aSeg
bResult = true;
}
if ( !bResult && nPathLen > nSegLen && aPath.copy( nPathLen - nSegLen - 1, nSegLen + 1 ) == aEndSegment )
if ( !bResult && nPathLen > nSegLen && aPath.subView( nPathLen - nSegLen - 1, nSegLen + 1 ) == aEndSegment )
bResult = true;
}
+188
View File
@@ -0,0 +1,188 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef LO_CLANG_SHARED_PLUGINS
#include <cassert>
#include <string>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include "plugin.hxx"
#include "check.hxx"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/StmtVisitor.h"
/**
Look for places where we are making a substring copy of an OUString, and then passing it to a
function that takes a u16string_view, in which case it is more efficient to pass a view
of the OUString, rather than making a copy.
TODO currently does not check if there is some other visible overload of the callee, that can take
a string_view.
TODO handle OUStringBuffer/OStringBuffer similarly
*/
namespace
{
class StringView : public loplugin::FilteringPlugin<StringView>
{
public:
explicit StringView(loplugin::InstantiationData const& data)
: FilteringPlugin(data)
{
}
bool preRun() override { return true; }
virtual void run() override
{
if (!preRun())
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
bool VisitCallExpr(CallExpr const*);
bool VisitCXXConstructExpr(CXXConstructExpr const*);
bool VisitFunctionDecl(FunctionDecl const*);
bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr const*);
};
bool StringView::VisitCallExpr(CallExpr const* callExpr)
{
if (ignoreLocation(callExpr))
return true;
const FunctionDecl* functionDecl;
if (isa<CXXMemberCallExpr>(callExpr))
functionDecl = dyn_cast<CXXMemberCallExpr>(callExpr)->getMethodDecl();
else
functionDecl = callExpr->getDirectCallee();
if (!functionDecl)
return true;
unsigned len = std::min(callExpr->getNumArgs(), functionDecl->getNumParams());
for (unsigned i = 0; i < len; ++i)
{
const Expr* argExpr = callExpr->getArg(i);
auto paramDecl = functionDecl->getParamDecl(i);
auto paramRecordDecl = dyn_cast_or_null<RecordDecl>(
paramDecl->getType()->getUnqualifiedDesugaredType()->getAsTagDecl());
if (!paramRecordDecl || !paramRecordDecl->getIdentifier()
|| paramRecordDecl->getName() != "basic_string_view")
continue;
// unwrap the operator that converts to std::u16string_view
auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(argExpr->IgnoreImpCasts());
if (!memberCallExpr)
continue;
// unwrap the call to copy()
auto memberCallExpr2 = dyn_cast<CXXMemberCallExpr>(
compat::IgnoreImplicit(memberCallExpr->getImplicitObjectArgument()));
if (!memberCallExpr2)
continue;
auto methodDecl = memberCallExpr2->getMethodDecl();
if (!methodDecl->getIdentifier() || methodDecl->getName() != "copy")
continue;
report(DiagnosticsEngine::Warning, "rather than copy, pass with a view using subView()",
compat::getBeginLoc(argExpr))
<< argExpr->getSourceRange();
}
return true;
}
bool StringView::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const* cxxOperatorCallExpr)
{
if (ignoreLocation(cxxOperatorCallExpr))
return true;
auto check = [&](const Expr* expr) -> void {
auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(compat::IgnoreImplicit(expr));
if (!memberCallExpr)
return;
auto methodDecl = memberCallExpr->getMethodDecl();
if (!methodDecl->getIdentifier() || methodDecl->getName() != "copy")
return;
report(DiagnosticsEngine::Warning, "rather than copy, pass with a view using subView()",
compat::getBeginLoc(expr))
<< expr->getSourceRange();
};
auto op = cxxOperatorCallExpr->getOperator();
if (op == OO_Plus && cxxOperatorCallExpr->getNumArgs() == 2)
{
check(cxxOperatorCallExpr->getArg(0));
check(cxxOperatorCallExpr->getArg(1));
}
if (compat::isComparisonOp(cxxOperatorCallExpr))
{
check(cxxOperatorCallExpr->getArg(0));
check(cxxOperatorCallExpr->getArg(1));
}
else if (op == OO_PlusEqual)
check(cxxOperatorCallExpr->getArg(1));
else if (op == OO_Subscript)
check(cxxOperatorCallExpr->getArg(0));
return true;
}
bool StringView::VisitFunctionDecl(FunctionDecl const* functionDecl)
{
if (ignoreLocation(functionDecl))
return true;
// debugging
// if (functionDecl->getIdentifier() && functionDecl->getName() == "f1")
// functionDecl->dump();
return true;
}
bool StringView::VisitCXXConstructExpr(CXXConstructExpr const* constructExpr)
{
if (ignoreLocation(constructExpr))
return true;
const CXXConstructorDecl* constructorDecl = constructExpr->getConstructor();
if (!constructorDecl)
return true;
unsigned len = std::min(constructExpr->getNumArgs(), constructorDecl->getNumParams());
for (unsigned i = 0; i < len; ++i)
{
const Expr* argExpr = constructExpr->getArg(i);
auto paramDecl = constructorDecl->getParamDecl(i);
auto paramRecordDecl = dyn_cast_or_null<RecordDecl>(
paramDecl->getType()->getUnqualifiedDesugaredType()->getAsTagDecl());
if (!paramRecordDecl || !paramRecordDecl->getIdentifier()
|| paramRecordDecl->getName() != "basic_string_view")
continue;
// unwrap the operator that converts to std::u16string_view
auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(argExpr->IgnoreImpCasts());
if (!memberCallExpr)
continue;
// unwrap the call to copy()
auto memberCallExpr2 = dyn_cast<CXXMemberCallExpr>(
compat::IgnoreImplicit(memberCallExpr->getImplicitObjectArgument()));
if (!memberCallExpr2)
continue;
auto methodDecl = memberCallExpr2->getMethodDecl();
if (!methodDecl->getIdentifier() || methodDecl->getName() != "copy")
continue;
report(DiagnosticsEngine::Warning, "rather than copy, pass with a view using subView()",
compat::getBeginLoc(argExpr))
<< argExpr->getSourceRange();
}
return true;
}
loplugin::Plugin::Registration<StringView> stringview("stringview");
}
#endif // LO_CLANG_SHARED_PLUGINS
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+96
View File
@@ -0,0 +1,96 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <rtl/strbuf.hxx>
#include <rtl/string.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
void call_view(std::u16string_view) {}
void call_view(std::string_view) {}
struct ConstructWithView
{
ConstructWithView(std::u16string_view) {}
ConstructWithView(std::string_view) {}
};
namespace test1
{
void f1(std::u16string_view s1)
{
// no warning expected
call_view(s1);
}
void f1(std::string_view s1)
{
// no warning expected
call_view(s1);
}
void f1(OUString s1)
{
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
call_view(s1.copy(1, 2));
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
call_view(s1.copy(1));
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
ConstructWithView(s1.copy(1, 2));
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
ConstructWithView(s1.copy(1));
}
void f1(OString s1)
{
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
call_view(s1.copy(1, 2));
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
call_view(s1.copy(1));
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
ConstructWithView(s1.copy(1, 2));
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
ConstructWithView(s1.copy(1));
}
}
namespace test2
{
void f3(OUString s1)
{
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
OUString s2 = s1.copy(1, 2) + "xxx";
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
s2 = s1.copy(1) + "xxx";
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
s2 = "xxx" + s1.copy(1);
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
s2 += s1.copy(1);
}
void f3(OString s1)
{
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
OString s2 = s1.copy(1, 2) + "xxx";
(void)s2;
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
OString s3 = s1.copy(1) + "xxx";
(void)s3;
}
}
namespace test3
{
void f4(OUString s1, OUString s2)
{
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
sal_Unicode x = s2.copy(1, 2)[12];
(void)x;
// expected-error@+1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
if (s2.copy(1, 2) < s1)
;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
@@ -116,7 +116,7 @@ OUString transformUrl(const OUString& _sUrl)
sNewUrl = "sdbc:" + sNewUrl;
else
{
sNewUrl = "jdbc:mysql://" + sNewUrl.copy(5);
sNewUrl = OUString::Concat("jdbc:mysql://") + sNewUrl.subView(5);
}
return sNewUrl;
}
@@ -175,7 +175,7 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal
sal_Int32 nLen = url.indexOf(':');
nLen = url.indexOf(':',nLen+2);
OUString aDSN("DSN="), aUID, aPWD, aSysDrvSettings;
aDSN += url.copy(nLen+1);
aDSN += url.subView(nLen+1);
sal_Int32 nTimeout = 20;
bool bSilent = true;
+2 -2
View File
@@ -250,7 +250,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping,
return;
}
uno_envDcp += rest.copy(0, index);
uno_envDcp += rest.subView(0, index);
}
else if (to_envPurpose == purpose)
{
@@ -263,7 +263,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping,
return;
}
uno_envDcp += rest.copy(0, index);
uno_envDcp += rest.subView(0, index);
}
uno_getEnvironment(&pInterm, uno_envDcp.pData, nullptr);
+1 -1
View File
@@ -1078,7 +1078,7 @@ static uno_Environment * initDefaultEnvironment(
if (!envPurpose.isEmpty())
{
OUString libStem(
envPurpose.copy(envPurpose.lastIndexOf(':') + 1) + "_uno_uno");
OUString::Concat(envPurpose.subView(envPurpose.lastIndexOf(':') + 1)) + "_uno_uno");
if(!loadEnv(libStem, pEnv))
{
pEnv->release(pEnv);
+3 -3
View File
@@ -98,13 +98,13 @@ static bool readOption( OUString * pValue, const char * pOpt,
if (aArg.getLength() < aOpt.getLength())
return false;
if (aOpt.equalsIgnoreAsciiCase( aArg.copy(1) ))
if (aOpt.equalsIgnoreAsciiCase( aArg.subView(1, aArg.getLength()-1) ))
{
// take next argument
++(*pnIndex);
rtl_getAppCommandArg(*pnIndex, &pValue->pData);
if (*pnIndex >= rtl_getAppCommandArgCount() || pValue->copy(1) == dash)
if (*pnIndex >= rtl_getAppCommandArgCount() || pValue->subView(1) == dash)
{
throw RuntimeException( "incomplete option \"-" + aOpt + "\" given!" );
}
@@ -128,7 +128,7 @@ static bool readOption( bool * pbOpt, const char * pOpt,
{
OUString aOpt = OUString::createFromAscii(pOpt);
if(aArg.startsWith("--") && aOpt == aArg.copy(2))
if(aArg.startsWith("--") && aOpt == aArg.subView(2))
{
++(*pnIndex);
*pbOpt = true;
+1 -1
View File
@@ -3072,7 +3072,7 @@ void SvxIconSelectorDialog::ImportGraphics(
OUStringBuffer message;
OUString fPath;
if (rejectedCount > 1)
fPath = rPaths[0].copy(8) + "/";
fPath = OUString::Concat(rPaths[0].subView(8)) + "/";
for ( sal_Int32 i = 0; i < rejectedCount; ++i )
{
message.append(fPath).append(rejected[i]).append("\n");
+1 -1
View File
@@ -153,7 +153,7 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet )
if ( aURL.getBase().getLength() > 18 )
{
aString += aURL.getBase().copy( 0, 15 ) + "...";
aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
}
else
aString += aURL.getBase();
+1 -1
View File
@@ -153,7 +153,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet )
if ( aURL.getBase().getLength() > 18 )
{
aString += aURL.getBase().copy( 0, 15 ) + "...";
aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
}
else
aString += aURL.getBase();
+1 -1
View File
@@ -151,7 +151,7 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet )
if( aURL.getBase().getLength() > 18 )
{
aString += aURL.getBase().copy( 0, 15 ) + "...";
aString += OUString::Concat(aURL.getBase().subView( 0, 15 )) + "...";
}
else
aString += aURL.getBase();
+2 -2
View File
@@ -42,12 +42,12 @@ namespace dbaui
{
if ( !isCharOk( _sToCheck[i], i == 0, m_sAllowedChars ) )
{
_rsCorrected += _sToCheck.copy(nMatch, i - nMatch);
_rsCorrected += _sToCheck.subView(nMatch, i - nMatch);
bCorrected = true;
nMatch = i + 1;
}
}
_rsCorrected += _sToCheck.copy( nMatch );
_rsCorrected += _sToCheck.subView( nMatch );
}
return bCorrected;
}
@@ -675,7 +675,7 @@ OUString replaceOrigin(
{
//get the file name of the xcu and add it to the url of the temporary folder
sal_Int32 i = url.lastIndexOf('/');
newUrl = destFolder + url.copy(i);
newUrl = destFolder + url.subView(i);
}
ucbhelper::Content(newUrl, xCmdEnv, xContext).writeStream(
@@ -216,7 +216,7 @@ OUString PackageRegistryBackend::createFolder(
const OUString baseDir(sDataFolder);
::utl::TempFile aTemp(&baseDir, true);
const OUString& url = aTemp.GetURL();
return sDataFolder + url.copy(url.lastIndexOf('/'));
return sDataFolder + url.subView(url.lastIndexOf('/'));
}
//folderURL can have the extension .tmp or .tmp_
+5 -9
View File
@@ -991,7 +991,7 @@ OUString desktop::extractParameter(OUString& rOptions, const OUString& rName)
if (nComma >= 0)
{
aValue = rOptions.copy(nIndex + nLen, nComma - nIndex - nLen);
rOptions = rOptions.copy(0, nIndex) + rOptions.copy(nComma);
rOptions = OUString::Concat(rOptions.subView(0, nIndex)) + rOptions.subView(nComma);
}
else
{
@@ -2563,19 +2563,15 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
if ((aIndex = aFilterOptions.indexOf(",Watermark=")) >= 0)
{
int bIndex = aFilterOptions.indexOf("WATERMARKEND");
watermarkText = aFilterOptions.copy(aIndex+11, bIndex-(aIndex+11));
OUString temp = aFilterOptions.copy(0, aIndex);
aFilterOptions = temp + aFilterOptions.copy(bIndex+12);
watermarkText = aFilterOptions.subView(aIndex+11, bIndex-(aIndex+11));
aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + aFilterOptions.subView(bIndex+12);
}
if ((aIndex = aFilterOptions.indexOf(",FullSheetPreview=")) >= 0)
{
int bIndex = aFilterOptions.indexOf("FULLSHEETPREVEND");
sFullSheetPreview = aFilterOptions.copy(aIndex+18, bIndex-(aIndex+18));
OUString temp = aFilterOptions.copy(0, aIndex);
aFilterOptions = temp + aFilterOptions.copy(bIndex+16);
sFullSheetPreview = aFilterOptions.subView(aIndex+18, bIndex-(aIndex+18));
aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + aFilterOptions.subView(bIndex+16);
}
bool bFullSheetPreview = sFullSheetPreview == "true";
+1 -1
View File
@@ -735,7 +735,7 @@ void MigrationImpl::copyFiles()
// LANGUAGE_DONTKNOW with the "[All]" autocorrection entry.
// As of LibreOffice 4.0 it is 'und' for LANGUAGE_UNDETERMINED
// so the file name is "acor_und.dat".
localName = localName.copy( 0, localName.getLength() - 4) + "und.dat";
localName = OUString::Concat(localName.subView( 0, localName.getLength() - 4)) + "und.dat";
}
destName = userInstall + localName;
INetURLObject aURL(destName);
+1 -1
View File
@@ -698,7 +698,7 @@ void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
nDepth = 0;
OUString aNewStyleSheetName( pStyle->GetName() );
aNewStyleSheetName = aNewStyleSheetName.copy( 0, aNewStyleSheetName.getLength()-1 ) +
aNewStyleSheetName = aNewStyleSheetName.subView( 0, aNewStyleSheetName.getLength()-1 ) +
OUString::number( nDepth+1 );
SfxStyleSheet* pNewStyle = static_cast<SfxStyleSheet*>(GetStyleSheetPool()->Find( aNewStyleSheetName, pStyle->GetFamily() ));
DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
+1 -1
View File
@@ -48,7 +48,7 @@ namespace pcr
}
}
OUString sNameBase = _rNameBase.copy( 0, nStripUntil ? nStripUntil + 1 : 0 ) + " ";
OUString sNameBase = OUString::Concat(_rNameBase.subView( 0, nStripUntil ? nStripUntil + 1 : 0 )) + " ";
OUString sInitialName;
sal_Int32 nPostfixNumber = 1;
do
+1 -1
View File
@@ -148,7 +148,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea
if (pos != -1)
{
OSL_FAIL("DEPRECATED!\nPlease use new query format: 'matchByDocumentService=...'");
OUString sPatchedQuery("matchByDocumentService=" + sNewQuery.copy(7));
OUString sPatchedQuery(OUString::Concat("matchByDocumentService=") + sNewQuery.subView(7));
sNewQuery = sPatchedQuery;
}
@@ -459,7 +459,7 @@ OUString DXFRepresentation::ToOUString(const OString& s) const
{
char ch = static_cast<char>(asciiNum.toUInt32());
OUString codePt(&ch, 1, mEnc);
result = result.replaceAll(result.copy(pos, 5), codePt, pos);
result = result.replaceAll(result.subView(pos, 5), codePt, pos);
}
pos = result.indexOf("%%", pos + 1);
}
@@ -473,7 +473,7 @@ OUString DXFRepresentation::ToOUString(const OString& s) const
lcl_isHex(codePtNum[3]))
{
OUString codePt(static_cast<sal_Unicode>(codePtNum.toUInt32(16)));
result = result.replaceAll(result.copy(pos, 7), codePt, pos);
result = result.replaceAll(result.subView(pos, 7), codePt, pos);
}
pos = result.indexOf("\\U+", pos + 1);
}
+2 -2
View File
@@ -147,10 +147,10 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath )
sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' );
if ( lastSlashIndex > -1 )
{
bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ) == aURL;
bDocNameNoPathMatch = xModel->getURL().subView( lastSlashIndex + 1 ) == aURL;
if ( !bDocNameNoPathMatch )
{
OUString aTmpName = "'" + xModel->getURL().copy( lastSlashIndex + 1 ) + "'";
OUString aTmpName = OUString::Concat("'") + xModel->getURL().subView( lastSlashIndex + 1 ) + "'";
bDocNameNoPathMatch = aTmpName == aURL;
}
}
+1 -1
View File
@@ -523,7 +523,7 @@ static EquationResult Read_SubF_Combined(WW8ReadFieldParams& rReadParam)
if (nBegin != -1 && nEnd != -1)
{
sCombinedCharacters +=
sPart.copy(nBegin+1,nEnd-nBegin-1);
sPart.subView(nBegin+1,nEnd-nBegin-1);
}
}
}
@@ -538,11 +538,11 @@ void XMLFilterTestDialog::onImportBrowse()
if( nLastIndex == -1 )
{
aExtensions += m_xFilterInfo->maExtension.copy( nCurrentIndex );
aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex );
}
else
{
aExtensions += m_xFilterInfo->maExtension.copy( nCurrentIndex, nLastIndex - nCurrentIndex );
aExtensions += m_xFilterInfo->maExtension.subView( nCurrentIndex, nLastIndex - nCurrentIndex );
nCurrentIndex = nLastIndex + 1;
nLastIndex = nCurrentIndex;
}
+1 -1
View File
@@ -392,7 +392,7 @@ void RemoteFilesDialog::AddFileExtension()
if ( nDotPos == -1 )
{
sFileName += sExt.copy( 1 ); // without '*'
sFileName += sExt.subView( 1 ); // without '*'
m_xName_ed->set_text( sFileName );
}
}
+1 -1
View File
@@ -114,7 +114,7 @@ void Breadcrumb::SetURL( const OUString& rURL )
}
m_aSegments[i]->m_xLink->set_label( sLabel );
m_aUris[m_aSegments[i]->m_xLink.get()] = sRootPath + sPath.copy(0, nEnd);
m_aUris[m_aSegments[i]->m_xLink.get()] = sRootPath + sPath.subView(0, nEnd);
m_aSegments[i]->m_xLink->hide();
m_aSegments[i]->m_xLink->set_sensitive(true);
+1 -1
View File
@@ -149,7 +149,7 @@ namespace
if (nDotPos>=0)
{
if (!rExtension.isEmpty())
rFile = rFile.copy(0, nDotPos) + rExtension; // replace old extension with new (not empty) one
rFile = rFile.subView(0, nDotPos) + rExtension; // replace old extension with new (not empty) one
else if (nDotPos)
rFile = rFile.copy(0, nDotPos-1); // truncate extension (new one is empty)
else
@@ -129,9 +129,9 @@ SAL_CALL PopupMenuDispatcher::queryDispatch(
{
sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart );
if ( nQueryPart > 0 )
aBaseURL += aURL.copy( nSchemePart+1, nQueryPart-(nSchemePart+1) );
aBaseURL += aURL.subView( nSchemePart+1, nQueryPart-(nSchemePart+1) );
else if ( nQueryPart == -1 )
aBaseURL += aURL.copy( nSchemePart+1 );
aBaseURL += aURL.subView( nSchemePart+1 );
}
css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider;
+2 -2
View File
@@ -89,7 +89,7 @@ OUString XMLNamespaces::applyNSToAttributeName( const OUString& aName ) const
// attribute with namespace but without name "namespace:" is not allowed!!
throw SAXException( "Attribute has no name only preceding namespace!", Reference< XInterface >(), Any() );
}
OUString aAttributeName = getNamespaceValue( aName.copy( 0, index )) + "^" + aName.copy( index+1);
OUString aAttributeName = getNamespaceValue( aName.copy( 0, index )) + "^" + aName.subView( index+1);
return aAttributeName;
}
@@ -123,7 +123,7 @@ OUString XMLNamespaces::applyNSToElementName( const OUString& aName ) const
// attribute with namespace but without a name is not allowed (e.g. "cfg:" )
throw SAXException( "Attribute has no name only preceding namespace!", Reference< XInterface >(), Any() );
}
aElementName += aName.copy( index+1 );
aElementName += aName.subView( index+1 );
}
else
aElementName += aName;
@@ -240,15 +240,15 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event )
// Replacement for place holders
if ( aStrValue.startsWith("($1)") )
{
aStrValue = FwkResId(STR_UPDATEDOC) + " " + aStrValue.copy( 4 );
aStrValue = FwkResId(STR_UPDATEDOC) + " " + aStrValue.subView( 4 );
}
else if ( aStrValue.startsWith("($2)") )
{
aStrValue = FwkResId(STR_CLOSEDOC_ANDRETURN) + aStrValue.copy( 4 );
aStrValue = FwkResId(STR_CLOSEDOC_ANDRETURN) + aStrValue.subView( 4 );
}
else if ( aStrValue.startsWith("($3)") )
{
aStrValue = FwkResId(STR_SAVECOPYDOC) + aStrValue.copy( 4 );
aStrValue = FwkResId(STR_SAVECOPYDOC) + aStrValue.subView( 4 );
}
m_xToolbar->SetItemText( m_nID, aStrValue );
// tdf#124267 strip mnemonic from tooltip
@@ -331,15 +331,15 @@ void SAL_CALL MenuBarManager::statusChanged( const FeatureStateEvent& Event )
// Replacement for place holders
if ( aItemText.startsWith("($1)") )
{
aItemText = FwkResId(STR_UPDATEDOC) + " " + aItemText.copy( 4 );
aItemText = FwkResId(STR_UPDATEDOC) + " " + aItemText.subView( 4 );
}
else if ( aItemText.startsWith("($2)") )
{
aItemText = FwkResId(STR_CLOSEDOC_ANDRETURN) + aItemText.copy( 4 );
aItemText = FwkResId(STR_CLOSEDOC_ANDRETURN) + aItemText.subView( 4 );
}
else if ( aItemText.startsWith("($3)") )
{
aItemText = FwkResId(STR_SAVECOPYDOC) + aItemText.copy( 4 );
aItemText = FwkResId(STR_SAVECOPYDOC) + aItemText.subView( 4 );
}
m_pVCLMenu->SetItemText( menuItemHandler->nItemId, aItemText );
@@ -1506,9 +1506,9 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController
OUString aMainURL( "vnd.sun.star.popup:" );
sal_Int32 nQueryPart = aMenuURL.indexOf( '?', nSchemePart );
if ( nQueryPart > 0 )
aMainURL += aMenuURL.copy( nSchemePart, nQueryPart-nSchemePart );
aMainURL += aMenuURL.subView( nSchemePart, nQueryPart-nSchemePart );
else if ( nQueryPart == -1 )
aMainURL += aMenuURL.copy( nSchemePart+1 );
aMainURL += aMenuURL.subView( nSchemePart+1 );
rPopupController.emplace( aMainURL, aPopupControllerEntry );
}
@@ -1957,7 +1957,7 @@ OUString LanguageTag::getGlibcLocaleString( const OUString & rEncoding ) const
aRet = getImpl()->getGlibcLocaleString();
sal_Int32 nAt = aRet.indexOf('@');
if (nAt != -1)
aRet = aRet.copy(0, nAt) + rEncoding + aRet.copy(nAt);
aRet = aRet.subView(0, nAt) + rEncoding + aRet.subView(nAt);
else
aRet += rEncoding;
}
+1 -1
View File
@@ -73,7 +73,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
printf("Code point 0x%lx exceeds MAX_ADDRESS 0x%x, Please increase MAX_ADDRESS", static_cast<long unsigned int>(nChar), MAX_ADDRESS);
exit(1);
}
OUString key=Ostr.copy(nPos)+sep;
OUString key=Ostr.subView(nPos)+sep;
sal_Int32 idx = result.indexOf(key);
if (key.getLength() > max) max=key.getLength();
if (idx >= 0) {
@@ -622,7 +622,7 @@ OUString getNumberText(const Locale& rLocale, const OUString& rNumberString,
}
OUString sResult = rItem;
if (i != 0 && i < len)
sResult += rNumberString.copy(i);
sResult += rNumberString.subView(i);
return sResult;
}
}
+40
View File
@@ -1393,6 +1393,46 @@ public:
return OString( pNew, SAL_NO_ACQUIRE );
}
#if defined LIBO_INTERNAL_ONLY
/**
Returns a std::string_view that is a view of a substring of this string.
The substring begins at the specified beginIndex. If
beginIndex is negative or be greater than the length of
this string, behaviour is undefined.
@param beginIndex the beginning index, inclusive.
@return the specified substring.
*/
SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex ) const
{
assert(beginIndex >= 0);
assert(beginIndex <= getLength());
return subView(beginIndex, getLength() - beginIndex);
}
/**
Returns a std::string_view that is a view of a substring of this string.
The substring begins at the specified beginIndex and contains count
characters. If either beginIndex or count are negative,
or beginIndex + count are greater than the length of this string
then behaviour is undefined.
@param beginIndex the beginning index, inclusive.
@param count the number of characters.
@return the specified substring.
*/
SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
{
assert(beginIndex >= 0);
assert(count >= 0);
assert(beginIndex <= getLength());
assert(count <= getLength() - beginIndex);
return std::string_view(*this).substr(beginIndex, count);
}
#endif
#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
/**
Concatenates the specified string to the end of this string.
+40
View File
@@ -2300,6 +2300,46 @@ public:
return OUString( pNew, SAL_NO_ACQUIRE );
}
#if defined LIBO_INTERNAL_ONLY
/**
Returns a std::u16string_view that is a view of a substring of this string.
The substring begins at the specified beginIndex. If
beginIndex is negative or be greater than the length of
this string, behaviour is undefined.
@param beginIndex the beginning index, inclusive.
@return the specified substring.
*/
SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const
{
assert(beginIndex >= 0);
assert(beginIndex <= getLength());
return subView(beginIndex, getLength() - beginIndex);
}
/**
Returns a std::u16string_view that is a view of a substring of this string.
The substring begins at the specified beginIndex and contains count
characters. If either beginIndex or count are negative,
or beginIndex + count are greater than the length of this string
then behaviour is undefined.
@param beginIndex the beginning index, inclusive.
@param count the number of characters.
@return the specified substring.
*/
SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
{
assert(beginIndex >= 0);
assert(count >= 0);
assert(beginIndex <= getLength());
assert(count <= getLength() - beginIndex);
return std::u16string_view(*this).substr(beginIndex, count);
}
#endif
#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
/**
Concatenates the specified string to the end of this string.
+1 -1
View File
@@ -93,7 +93,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
HelpParser aParser( sXhpFile );
const OString sOutput(
aArgs.m_sOutputFile +
sXhpFile.copy( sXhpFile.lastIndexOf('/') ));
sXhpFile.subView( sXhpFile.lastIndexOf('/') ));
if( !aParser.Merge( sOutput,
aArgs.m_sLanguage, pMergeDataFile.get() ))
{
+1 -1
View File
@@ -233,7 +233,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResDa
pEntrys->GetText( sNewText, sCur, true );
if (helper::isWellFormedXML(XMLUtil::QuotHTML(sNewText)))
{
sNewdata = sSourceText.copy(0,nPreSpaces) + sNewText;
sNewdata = sSourceText.subView(0,nPreSpaces) + sNewText;
}
}
}
+1 -1
View File
@@ -381,7 +381,7 @@ void handleDirectory(
if (aProject == "include" && nLevel > 1)
{
aProject = aPotDir.copy(aPotDir.lastIndexOf('/') + 1);
aPotDir = aPotDir.copy(0, aPotDir.lastIndexOf("include")) + aProject + "/messages";
aPotDir = aPotDir.subView(0, aPotDir.lastIndexOf("include")) + aProject + "/messages";
}
if (aProject != "include")
{
+1 -1
View File
@@ -219,7 +219,7 @@ void GenPoEntry::readFromFile(std::ifstream& rIFStream)
{
// assume there are no more than 10 plural forms...
// and that plural strings are never split to multi-line in po
m_sMsgStrPlural.push_back(sLine.copy(0,10) + lcl_GenNormString(sLine.copy(10)));
m_sMsgStrPlural.push_back(sLine.subView(0,10) + lcl_GenNormString(sLine.copy(10)));
}
else if (sLine.startsWith("\"") && pLastMsg)
{
+4 -4
View File
@@ -72,9 +72,9 @@ namespace
// Update id attribute of topic
{
OString sNewID =
sID.copy( 0, nFirstSlash + 1 ) +
rXhpRoot.copy( rXhpRoot.lastIndexOf('/') + 1 ) +
sID.copy( sID.indexOf( '/', nFirstSlash + 1 ) );
OString::Concat(sID.subView( 0, nFirstSlash + 1 )) +
rXhpRoot.subView( rXhpRoot.lastIndexOf('/') + 1 ) +
sID.subView( sID.indexOf( '/', nFirstSlash + 1 ) );
xmlSetProp(
pReturn, reinterpret_cast<const xmlChar*>("id"),
reinterpret_cast<const xmlChar*>(sNewID.getStr()));
@@ -82,7 +82,7 @@ namespace
const OString sXhpPath =
rXhpRoot +
sID.copy(sID.indexOf('/', nFirstSlash + 1));
sID.subView(sID.indexOf('/', nFirstSlash + 1));
xmlDocPtr pXhpFile = xmlParseFile( sXhpPath.getStr() );
// if xhpfile is missing than put this topic into comment
if ( !pXhpFile )
+1 -1
View File
@@ -422,7 +422,7 @@ void XRMResMerge::WorkOnDesc(
throw false; //TODO
}
OString sOutputDescFile(
sOutputFile.copy(0, i + 1) + sLocDescFilename);
sOutputFile.subView(0, i + 1) + sLocDescFilename);
ofstream file(sOutputDescFile.getStr());
if (file.is_open()) {
file << sText;
@@ -350,7 +350,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
if (catpos > 2)
{
// remove category name for affixation and casing
catst = " " + sTerm.copy(catpos);
catst = OUString::Concat(" ") + sTerm.subView(catpos);
sTerm = sTerm.copy(0, catpos);
sTerm = sTerm.trim();
}
@@ -429,15 +429,15 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
sal_Int32 pos = aRTerm.lastIndexOf(' ');
if (!pos)
return noMeanings;
xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
aRTerm.copy(pos + 1) + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
xTmpRes = xSpell->spell( OUString::Concat("<?xml?><query type='stem'><word>") +
aRTerm.subView(pos + 1) + "</word></query>", static_cast<sal_uInt16>(nLanguage), rProperties );
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();
if (seq.hasElements())
{
aPTerm = aRTerm.copy(pos + 1);
aRTerm = aRTerm.copy(0, pos + 1) + seq[0];
aRTerm = aRTerm.subView(0, pos + 1) + seq[0];
#if 0
for (int i = 0; i < seq.getLength(); i++)
{
+2 -2
View File
@@ -450,9 +450,9 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL)
pStream->WriteLine("type: negative");
if (aDicName.endsWith(EXTENSION_FOR_TITLE_TEXT))
{
pStream->WriteLine(OUStringToOString("title: " +
pStream->WriteLine(OUStringToOString(OUString::Concat("title: ") +
// strip EXTENSION_FOR_TITLE_TEXT
aDicName.copy(0, aDicName.lastIndexOf(EXTENSION_FOR_TITLE_TEXT)), eEnc));
aDicName.subView(0, aDicName.lastIndexOf(EXTENSION_FOR_TITLE_TEXT)), eEnc));
}
if (ERRCODE_NONE != (nErr = pStream->GetError()))
return nErr;
+2 -2
View File
@@ -293,7 +293,7 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const
aUrl.match( aFilePrefix ) &&
aUrl.match( aUncPrefix, nFilePrefixLen ) )
{
return aFileSchema + aUrl.copy( nFilePrefixLen );
return aFileSchema + aUrl.subView( nFilePrefixLen );
}
/* (5) handle URLs relative to current drive, e.g. the URL '/path1/file1'
@@ -303,7 +303,7 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const
mxImpl->maFileUrl.match( aFilePrefix ) &&
lclIsDosDrive( mxImpl->maFileUrl, nFilePrefixLen ) )
{
return mxImpl->maFileUrl.copy( 0, nFilePrefixLen + 3 ) + aUrl.copy( 1 );
return OUString::Concat(mxImpl->maFileUrl.subView( 0, nFilePrefixLen + 3 )) + aUrl.subView( 1 );
}
try
+1 -1
View File
@@ -392,7 +392,7 @@ bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHan
OUString sLowerCaseFileName = fileName.toAsciiLowerCase();
if ( fileName != sLowerCaseFileName )
{
aFragmentPath = aFragmentPath.copy(0, nPathLen) + sLowerCaseFileName;
aFragmentPath = aFragmentPath.subView(0, nPathLen) + sLowerCaseFileName;
xInStrm = openInputStream(aFragmentPath);
}
}
+1 -1
View File
@@ -2380,7 +2380,7 @@ void XmlStreamObject::implDumpText( TextInputStream& rTextStrm )
{
while( (nPos < aElem.getLength()) && (aElem[ nPos ] >= 32) ) ++nPos;
if( nPos < aElem.getLength() )
aElem = aElem.copy( 0, nPos ) + OUStringChar(' ') + aElem.copy( nPos ).trim();
aElem = aElem.subView( 0, nPos ) + OUStringChar(' ') + aElem.copy( nPos ).trim();
++nPos;
}
+1 -1
View File
@@ -4863,7 +4863,7 @@ void DrawingML::writeDiagramRels(const uno::Sequence<uno::Sequence<uno::Any>>& x
if (sExtension.equalsIgnoreAsciiCase(".WMF"))
sContentType = "image/x-wmf";
else
sContentType = "image/" + sExtension.copy(1);
sContentType = OUString::Concat("image/") + sExtension.subView(1);
sRelId = sRelId.copy(3);
StreamDataSequence dataSeq;
+2 -2
View File
@@ -133,8 +133,8 @@ bool OZipFileAccess::StringGoodForPattern_Impl( const OUString& aString,
sal_Int32 nBeginInd = aPattern[0].getLength();
sal_Int32 nEndInd = aString.getLength() - aPattern[nInd].getLength();
if ( nEndInd >= nBeginInd
&& ( nEndInd == aString.getLength() || aString.copy( nEndInd ) == aPattern[nInd] )
&& ( nBeginInd == 0 || aString.copy( 0, nBeginInd ) == aPattern[0] ) )
&& ( nEndInd == aString.getLength() || aString.subView( nEndInd ) == aPattern[nInd] )
&& ( nBeginInd == 0 || aString.subView( 0, nBeginInd ) == aPattern[0] ) )
{
for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- )
{
+2 -2
View File
@@ -766,12 +766,12 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
if (lastIndex >= 0)
{
sRelativKey += keyName.copy(lastIndex + 1);
sRelativKey += keyName.subView(lastIndex + 1);
if (sFullKeyName.getLength() > 1)
sFullKeyName += keyName;
else
sFullKeyName += keyName.copy(1);
sFullKeyName += keyName.subView(1);
sFullPath = sFullKeyName.copy(0, keyName.lastIndexOf('/') + 1);
} else
@@ -63,7 +63,7 @@ static void lcl_correctCellAddress(const OUString & _sName, const uno::Reference
const sal_Int32 nPos = sCellAddress.lastIndexOf('$');
if ( nPos != -1 )
{
sCellAddress = sCellAddress.copy(0,nPos) + "$65535";
sCellAddress = OUString::Concat(sCellAddress.subView(0,nPos)) + "$65535";
pList->RemoveAttribute(_sName);
pList->AddAttribute(_sName,sCellAddress);
}
+1 -1
View File
@@ -1090,7 +1090,7 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula
{
OUString sFormula = aDlg.getCurrentFormula();
if ( sFormula[0] == '=' )
_in_out_rFormula = "rpt:" + sFormula.copy(1);
_in_out_rFormula = OUString::Concat("rpt:") + sFormula.subView(1);
else
_in_out_rFormula = "rpt:" + sFormula;
}
+1 -1
View File
@@ -73,7 +73,7 @@ static OUString getExecutablePath()
osl::Module::getUrlFromAddress(
reinterpret_cast<oslGenericFunction>(&getExecutablePath), dirPath);
dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') );
dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') + 1) +
dirPath = OUString::Concat(dirPath.subView( 0, dirPath.lastIndexOf('/') + 1)) +
"Executable";
return dirPath;
}
+1 -1
View File
@@ -57,7 +57,7 @@ static OUString getModulePath()
printUString(suDirPath, "modulePath:");
suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') );
suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1) + "bin";
suDirPath = OUString::Concat(suDirPath.subView( 0, suDirPath.lastIndexOf('/') + 1)) + "bin";
return suDirPath;
}
+2 -2
View File
@@ -108,7 +108,7 @@ OUString TestDocumentHandler::canonicalform(const OUString &sName, const OUStrin
if ( nIndex >= 0 )
{
OUString sNamespace = getNamespace( sName.copy( 0, nIndex ) );
return sNamespace + sName.copy(nIndex);
return sNamespace + sName.subView(nIndex);
}
else
{
@@ -231,7 +231,7 @@ OUString resolveNamespace( const OUString& aName )
if ( aName.getLength() > index + 1 )
{
OUString aAttributeName = getNamespaceValue( aName.copy( 0, index ) ) +
":" + aName.copy( index + 1 );
":" + aName.subView( index + 1 );
return aAttributeName;
}
}
+3 -3
View File
@@ -1485,7 +1485,7 @@ static bool NormalizeW3URI( OUString& rName )
{
const OUString& sURISuffix = XML_URI_XFORMS_SUFFIX ;
sal_Int32 nCompareFrom = rName.getLength() - sURISuffix.getLength();
if( rName.copy( nCompareFrom ) == sURISuffix )
if( rName.subView( nCompareFrom ) == sURISuffix )
{
// found W3 prefix, and xforms suffix
rName = XML_N_XFORMS_1_0;
@@ -1568,9 +1568,9 @@ static bool NormalizeOasisURN( OUString& rName )
// replace [tcid] with current TCID and version with current version.
rName = rName.copy( 0, nTCIdStart ) +
rName = rName.subView( 0, nTCIdStart ) +
XML_OPENDOCUMENT +
rName.copy( nTCIdEnd, nVersionStart-nTCIdEnd ) +
rName.subView( nTCIdEnd, nVersionStart-nTCIdEnd ) +
XML_1_0;
return true;
+1 -1
View File
@@ -181,7 +181,7 @@ OUString LimitedString( const OUString& str )
if( str.getLength() < 20 )
return "\"" + str + "\"";
else
return "\"" + str.copy( 0, 20 ) + "\"...";
return OUString::Concat("\"") + str.subView( 0, 20 ) + "\"...";
}
// Returns formatted contents of the data (possibly shortened), to be used in debug output.
+1 -1
View File
@@ -3402,7 +3402,7 @@ void ScInterpreter::ScNumberValue()
aTemporary = aTemporary.replaceAll( OUString( &nChar, 1 ), "" );
}
if ( nDecSep >= 0 )
aInputString = aTemporary + aInputString.copy( nDecSep );
aInputString = aTemporary + aInputString.subView( nDecSep );
else
aInputString = aTemporary;
}
+1 -1
View File
@@ -53,7 +53,7 @@ bool ScRangeUtil::MakeArea( const OUString& rAreaStr,
if ( nColonPos == -1 && nPointPos != -1 )
{
aStrArea += ":" + rAreaStr.copy( nPointPos+1 ); // do not include '.' in copy
aStrArea += OUString::Concat(":") + rAreaStr.subView( nPointPos+1 ); // do not include '.' in copy
}
bSuccess = ConvertDoubleRef( rDoc, aStrArea, nTab, startPos, endPos, rDetails );
+2 -2
View File
@@ -324,9 +324,9 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
nLoopStart = nEEnd;
}
OUString aTotal = maFormula.copy(0, nStartPos) + aResult.makeStringAndClear();
OUString aTotal = maFormula.subView(0, nStartPos) + aResult.makeStringAndClear();
if (nEndPos < maFormula.getLength()-1)
aTotal += maFormula.copy(nEndPos+1);
aTotal += maFormula.subView(nEndPos+1);
maFormula = aTotal;
}
+1 -1
View File
@@ -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) + "-" + OUString::number(i);
aNewName = OUString::Concat(rOriginalName.subView(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))
{
+1 -1
View File
@@ -1376,7 +1376,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
// an error formula cell.
if (aText.startsWithIgnoreAsciiCase("Err:") && aText.getLength() <= 9 &&
((nError =
GetScImport().GetFormulaErrorConstant( "#ERR" + aText.copy(4) + "!")) != FormulaError::NONE))
GetScImport().GetFormulaErrorConstant( OUString::Concat("#ERR") + aText.subView(4) + "!")) != FormulaError::NONE))
{
pCode->SetCodeError(nError);
}
+2 -2
View File
@@ -1642,7 +1642,7 @@ void ScInputHandler::PasteFunctionData()
const ScTypedStrData& rData = *miAutoPosFormula;
OUString aInsert = rData.GetString();
if (aInsert[aInsert.getLength()-1] == cParenthesesReplacement)
aInsert = aInsert.copy( 0, aInsert.getLength()-1) + "()";
aInsert = OUString::Concat(aInsert.subView( 0, aInsert.getLength()-1)) + "()";
bool bParInserted = false;
DataChanging(); // Cannot be new
@@ -1792,7 +1792,7 @@ void ScInputHandler::PasteManualTip()
// FIXME: Once we have matrix constants, we can change this
sal_Int32 nTipLen = aManualTip.getLength();
sal_uInt32 const nTipLen2(sal::static_int_cast<sal_uInt32>(nTipLen));
if ( nTipLen && ( nTipLen < 3 || aManualTip.copy( nTipLen2-3 ) != "..." ) )
if ( nTipLen && ( nTipLen < 3 || aManualTip.subView( nTipLen2-3 ) != u"..." ) )
{
DataChanging(); // Cannot be new
+1 -1
View File
@@ -1187,7 +1187,7 @@ static bool lcl_PutString(
if (nFound > 6)
{
sal_Unicode cDec = '.';
OUString aT = OUStringChar(cDec) + rStr.copy( nStart[6], nEnd[6]+1-nStart[6]);
OUString aT = OUStringChar(cDec) + rStr.subView( nStart[6], nEnd[6]+1-nStart[6]);
rtl_math_ConversionStatus eStatus;
double fV = rtl::math::stringToDouble( aT, cDec, 0, &eStatus );
if (eStatus == rtl_math_ConversionStatus_Ok)
+2 -2
View File
@@ -1507,10 +1507,10 @@ void ScContentTree::SelectDoc(const OUString& rName) // rName like shown in
OUString aRealName = rName;
sal_Int32 nLen = rName.getLength();
sal_Int32 nActiveStart = nLen - pParentWindow->aStrActive.getLength();
if ( rName.copy( nActiveStart ) == pParentWindow->aStrActive )
if ( rName.subView( nActiveStart ) == pParentWindow->aStrActive )
aRealName = rName.copy( 0, nActiveStart );
sal_Int32 nNotActiveStart = nLen - pParentWindow->aStrNotActive.getLength();
if ( rName.copy( nNotActiveStart ) == pParentWindow->aStrNotActive )
if ( rName.subView( nNotActiveStart ) == pParentWindow->aStrNotActive )
aRealName = rName.copy( 0, nNotActiveStart );
bool bLoaded = false;
+1 -1
View File
@@ -2058,7 +2058,7 @@ sal_Int16 ConvertData::GetMatchingLevel( const OUString& rRef ) const
sal_Int32 nLen = rRef.getLength();
sal_Int32 nIndex = rRef.lastIndexOf( '^' );
if( nIndex > 0 && nIndex == ( nLen - 2 ) )
aStr = aStr.copy( 0, nLen - 2 ) + OUStringChar( aStr[ nLen - 1 ] );
aStr = aStr.subView( 0, nLen - 2 ) + OUStringChar( aStr[ nLen - 1 ] );
if( aName == aStr )
return 0;
else
+5 -5
View File
@@ -512,10 +512,10 @@ namespace dlgprov
sal_Int32 nIndex = sScriptCode.indexOf( ':' );
if ( nIndex >= 0 && nIndex < sScriptCode.getLength() )
{
sScriptURL = "vnd.sun.star.script:" +
sScriptCode.copy( nIndex + 1 ) +
sScriptURL = OUString::Concat("vnd.sun.star.script:") +
sScriptCode.subView( nIndex + 1 ) +
"?language=Basic&location=" +
sScriptCode.copy( 0, nIndex );
sScriptCode.subView( 0, nIndex );
}
ScriptEvent aSFScriptEvent( aScriptEvent );
aSFScriptEvent.ScriptCode = sScriptURL;
@@ -612,9 +612,9 @@ namespace dlgprov
sal_Int32 nIndex = aRes.indexOf( '%' );
OUString aOUFinal =
aRes.copy( 0, nIndex ) +
aRes.subView( 0, nIndex ) +
aQuoteChar + aMethodName + aQuoteChar +
aRes.copy( nIndex + 2 );
aRes.subView( nIndex + 2 );
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
VclMessageType::Warning, VclButtonsType::Ok, aOUFinal));
+2 -2
View File
@@ -1527,7 +1527,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
if(aOriginalNewLayoutName != aTargetNewLayoutName)
{
const sal_Int32 nPos(aName.indexOf(SD_LT_SEPARATOR));
aName = aTargetNewLayoutName + aName.copy(nPos);
aName = aTargetNewLayoutName + aName.subView(nPos);
}
SfxStyleSheet* pMySheet = static_cast<SfxStyleSheet*>( mxStyleSheetPool->Find(aName, SfxStyleFamily::Page) );
@@ -1568,7 +1568,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
// this new style
OUString aTemp(pMySheet->GetName());
const sal_Int32 nPos(aTemp.indexOf(SD_LT_SEPARATOR));
aTemp = aOldLayoutName + aTemp.copy(nPos);
aTemp = aOldLayoutName + aTemp.subView(nPos);
aReplData.aName = aTemp;
aReplList.push_back(aReplData);
}
+1 -1
View File
@@ -569,7 +569,7 @@ bool PPTWriterBase::GetStyleSheets()
if ( nInstance == EPP_TEXTTYPE_Body )
{
sal_Unicode cTemp = aStyle[aStyle.getLength() - 1];
aStyle = aStyle.copy(0, aStyle.getLength() - 1) + OUStringChar(++cTemp);
aStyle = aStyle.subView(0, aStyle.getLength() - 1) + OUStringChar(++cTemp);
if ( aXFamily->hasByName( aStyle ) )
{
aXFamily->getByName( aStyle ) >>= xStyle;
+1 -1
View File
@@ -212,7 +212,7 @@ void SdCustomShowDlg::SelectHdl(void const *p)
const CharClass* pCharClass = rDoc.GetCharClass();
while( pCharClass->isDigit( aStr, nStrPos ) )
aStr = aStr.replaceAt( nStrPos, 1, "" );
aStr = aStr.copy( 0, nStrPos) + OUString::number( ++nNum ) + aStr.copy( nStrPos);
aStr = aStr.subView( 0, nStrPos) + OUString::number( ++nNum ) + aStr.subView( nStrPos);
}
}
+1 -1
View File
@@ -316,7 +316,7 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
***********************************************/
OUString aName( pPage->GetLayoutName() );
sal_Int32 n = aName.indexOf(SD_LT_SEPARATOR) + strlen(SD_LT_SEPARATOR);
aName = aName.copy(0, n) + STR_LAYOUT_BACKGROUNDOBJECTS;
aName = OUString::Concat(aName.subView(0, n)) + STR_LAYOUT_BACKGROUNDOBJECTS;
SfxStyleSheet* pSheet(
static_cast< SfxStyleSheet* >(
pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page)));
+1 -1
View File
@@ -632,7 +632,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
{
rDocliner.Insert( pOutliner->GetText(pSourcePara), nTargetPos, nDepth );
OUString aStyleSheetName( pStyleSheet->GetName() );
aStyleSheetName = aStyleSheetName.copy( 0, aStyleSheetName.getLength()-1 ) +
aStyleSheetName = aStyleSheetName.subView( 0, aStyleSheetName.getLength()-1 ) +
OUString::number( nDepth <= 0 ? 1 : nDepth+1 );
SfxStyleSheetBasePool* pStylePool = mpDoc->GetStyleSheetPool();
SfxStyleSheet* pOutlStyle = static_cast<SfxStyleSheet*>( pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ) );
+3 -3
View File
@@ -2131,7 +2131,7 @@ OUString getPageApiNameFromUiName( const OUString& rUIName )
if( rUIName.startsWith( aDefPageName ) )
{
aApiName = sEmptyPageName + rUIName.copy( aDefPageName.getLength() );
aApiName = OUString::Concat(sEmptyPageName) + rUIName.subView( aDefPageName.getLength() );
}
else
{
@@ -2839,7 +2839,7 @@ void SdMasterPage::setBackground( const Any& rValue )
if(pSSPool)
{
OUString aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4) +
aLayoutName = OUString::Concat(aLayoutName.subView(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4)) +
STR_LAYOUT_BACKGROUND;
SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
@@ -2885,7 +2885,7 @@ void SdMasterPage::getBackground( Any& rValue )
if(pSSPool)
{
OUString aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4) +
aLayoutName = OUString::Concat(aLayoutName.subView(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4)) +
STR_LAYOUT_BACKGROUND;
SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
@@ -1610,7 +1610,7 @@ OUString PresenterSlideSorter::MouseOverManager::GetFittingText (
const OUString sEllipses ("...");
while (true)
{
const OUString sCandidate (rsText.copy(0,nLength) + sEllipses);
const OUString sCandidate (rsText.subView(0,nLength) + sEllipses);
const double nWidth (
PresenterCanvasHelper::GetTextSize(mpFont->mxFont, sCandidate).Width);
if (nWidth > nMaximalWidth)
+1 -1
View File
@@ -517,7 +517,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
OUString sURL(officecfg::Office::Common::Menus::SendFeedbackURL::get() + //officecfg/registry/data/org/openoffice/Office/Common.xcu => https://hub.libreoffice.org/send-feedback/
"?LOversion=" + utl::ConfigManager::getAboutBoxProductVersion() +
"&LOlocale=" + utl::ConfigManager::getUILocale() +
"&LOmodule=" + module.copy(module.lastIndexOf('.') + 1 ) );
"&LOmodule=" + module.subView(module.lastIndexOf('.') + 1 ) );
sfx2::openUriExternally(sURL, false);
break;
}
+4 -4
View File
@@ -707,7 +707,7 @@ static bool impl_showOnlineHelp( const OUString& rURL )
return false;
OUString aHelpLink = officecfg::Office::Common::Help::HelpRootURL::get();
OUString aTarget = "Target=" + rURL.copy(aInternal.getLength());
OUString aTarget = OUString::Concat("Target=") + rURL.subView(aInternal.getLength());
aTarget = aTarget.replaceAll("%2F", "/").replaceAll("?", "&");
aHelpLink += aTarget;
@@ -888,8 +888,8 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
<< "\" doesn't contain files segment");
throw Failure();
}
path = path.copy(0, i1) + "/runtime/org.libreoffice.LibreOffice.Help/"
+ path.copy(i2, i3 - i2) + sha + path.copy(i4);
path = path.subView(0, i1) + OUString::Concat("/runtime/org.libreoffice.LibreOffice.Help/")
+ path.subView(i2, i3 - i2) + sha + path.subView(i4);
// Turn <path> into a file URL:
OUString url_;
err = osl::FileBase::getFileURLFromSystemPath(path, url_);
@@ -930,7 +930,7 @@ static bool impl_showOfflineHelp( const OUString& rURL )
}
OUString aHelpLink( aBaseInstallPath + "/index.html?" );
OUString aTarget = "Target=" + rURL.copy(RTL_CONSTASCII_LENGTH("vnd.sun.star.help://"));
OUString aTarget = OUString::Concat("Target=") + rURL.subView(RTL_CONSTASCII_LENGTH("vnd.sun.star.help://"));
aTarget = aTarget.replaceAll("%2F","/").replaceAll("?","&");
aHelpLink += aTarget;
+1 -1
View File
@@ -248,7 +248,7 @@ void ThumbnailViewItem::addTextPrimitives (const OUString& rText, const Thumbnai
--nLength;
}
aText = aText.copy(0, nLineStart+nLength) + "...";
aText = OUString::Concat(aText.subView(0, nLineStart+nLength)) + "...";
nLineLength = nLength + 3;
}
+1 -1
View File
@@ -256,7 +256,7 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, QueryTooltipHdl, const weld::TreeIter&,
const sal_Int32 nMaxLen = 80;
if (sUsedBy.getLength() > nMaxLen)
{
sUsedBy = sUsedBy.copy(0, nMaxLen) + "...";
sUsedBy = OUString::Concat(sUsedBy.subView(0, nMaxLen)) + "...";
}
OUString aMessage = SfxResId(STR_STYLEUSEDBY);
+1 -1
View File
@@ -798,7 +798,7 @@ OUString SfxObjectShell::GetTitle( sal_uInt16 nMaxLength ) const
{
const OUString aComplete( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
if( aComplete.getLength() > nMaxLength )
return "..." + aComplete.copy( aComplete.getLength() - nMaxLength + 3, nMaxLength - 3 );
return OUString::Concat("...") + aComplete.subView( aComplete.getLength() - nMaxLength + 3, nMaxLength - 3 );
return aComplete;
}
if ( nMaxLength == SFX_TITLE_FILENAME )
+2 -2
View File
@@ -2600,7 +2600,7 @@ static void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines )
else
nEndPos++;
rStr = rStr.copy( 0, nStartPos ) + rStr.copy( nEndPos );
rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( nEndPos );
}
// erase trailing lines
if ( nStartPos != -1 )
@@ -2611,7 +2611,7 @@ static void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines )
n++;
if ( n > nStartPos )
rStr = rStr.copy( 0, nStartPos ) + rStr.copy( n );
rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( n );
}
}
@@ -88,6 +88,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/stringconstant \
compilerplugins/clang/test/stringloop \
compilerplugins/clang/test/stringstatic \
compilerplugins/clang/test/stringview \
compilerplugins/clang/test/typedefparam \
compilerplugins/clang/test/unnecessarycatchthrow \
compilerplugins/clang/test/unnecessaryoverride \
+1 -1
View File
@@ -1592,7 +1592,7 @@ IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void)
// display Unicode position as symbol name while iterating over characters
const OUString aHex(OUString::number(cChar, 16).toAsciiUpperCase());
const OUString aPattern( (aHex.getLength() > 4) ? OUString("Ux000000") : OUString("Ux0000") );
OUString aUnicodePos = aPattern.copy( 0, aPattern.getLength() - aHex.getLength() ) +
OUString aUnicodePos = aPattern.subView( 0, aPattern.getLength() - aHex.getLength() ) +
aHex;
m_xSymbols->set_entry_text(aUnicodePos);
m_xSymbolName->set_label(aUnicodePos);
+3 -3
View File
@@ -420,7 +420,7 @@ OUString SmOoxmlImport::handleFunc()
OUString fname = readOMathArgInElement( M_TOKEN( fName ));
// fix the various functions
if( fname.startsWith( "lim csub {" ))
fname = "lim from {" + fname.copy( 10 );
fname = OUString::Concat("lim from {") + fname.subView( 10 );
OUString ret = fname + " {" + readOMathArgInElement( M_TOKEN( e )) + "}";
m_rStream.ensureClosingTag( M_TOKEN( func ));
return ret;
@@ -435,9 +435,9 @@ OUString SmOoxmlImport::handleLimLowUpp( LimLowUpp_t limlowupp )
m_rStream.ensureClosingTag( token );
// fix up overbrace/underbrace (use { }, as {} will be converted to a placeholder)
if( limlowupp == LimUpp && e.endsWith( " overbrace { }" ))
return e.copy( 0, e.getLength() - 2 ) + lim + "}";
return e.subView( 0, e.getLength() - 2 ) + lim + "}";
if( limlowupp == LimLow && e.endsWith( " underbrace { }" ))
return e.copy( 0, e.getLength() - 2 ) + lim + "}";
return e.subView( 0, e.getLength() - 2 ) + lim + "}";
return e
+ ( limlowupp == LimLow ? OUStringLiteral( u" csub {" ) : OUStringLiteral( u" csup {" ))
+ lim + "}";
@@ -821,7 +821,7 @@ sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OU
throw InvalidRegistryException();
}
resolvedName += aLinkName.copy(lastIndex);
resolvedName += aLinkName.subView(lastIndex);
}
else
{
@@ -875,7 +875,7 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
throw InvalidRegistryException();
}
resolvedName += rLinkName.copy(lastIndex);
resolvedName += rLinkName.subView(lastIndex);
}
else
{
@@ -917,7 +917,7 @@ OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
throw InvalidRegistryException();
}
resolvedName += rLinkName.copy(lastIndex);
resolvedName += rLinkName.subView(lastIndex);
}
else
{
@@ -194,7 +194,7 @@ void prepareLink( const Reference < XSimpleRegistry > & xDest,
if (pShortName)
{
linkRefName += link.copy(pShortName - pTmpName + 1);
linkRefName += link.subView(pShortName - pTmpName + 1);
linkName = link.copy(0, pShortName - pTmpName);
}
@@ -223,13 +223,13 @@ namespace svgio::svgreader
if(nIndexTokenImportant > 0)
{
// copy content before token
aNewOUTokenValue += aOUTokenValue.copy(0, nIndexTokenImportant);
aNewOUTokenValue += aOUTokenValue.subView(0, nIndexTokenImportant);
}
if(aOUTokenValue.getLength() > nIndexTokenImportant + aTokenImportant.getLength())
{
// copy content after token
aNewOUTokenValue += aOUTokenValue.copy(nIndexTokenImportant + aTokenImportant.getLength());
aNewOUTokenValue += aOUTokenValue.subView(nIndexTokenImportant + aTokenImportant.getLength());
}
// remove spaces
+1 -1
View File
@@ -179,7 +179,7 @@ OUString normalize(
normalized = n == -1 ? uriReference : uriReference.copy(0, n);
switch (normalizePrefix(broker, normalized, &normalized)) {
case Success:
return n == -1 ? normalized : normalized + uriReference.copy(n);
return n == -1 ? normalized : normalized + uriReference.subView(n);
case GeneralFailure:
return uriReference;
case SpecificFailure:
+1 -1
View File
@@ -1256,7 +1256,7 @@ static bool lcl_IsSignedYearSep( const OUString& rStr, const OUString& rPat, sal
if (nPat + nLen < rPat.getLength() && rPat[nPat+nLen] == 'Y')
{
// Signed year is possible.
bOk = (rPat.indexOf( rStr.copy( 0, nLen), nPat) == nPat);
bOk = (rPat.indexOf( rStr.subView( 0, nLen), nPat) == nPat);
}
}
return bOk;
+1 -1
View File
@@ -755,7 +755,7 @@ bool SvtURLBox_Impl::TildeParsing(
if( !aParseTilde.endsWith("/") )
aParseTilde += "/";
if( aText.getLength() > 2 )
aParseTilde += aText.copy( 2 );
aParseTilde += aText.subView( 2 );
}
aText = aParseTilde;
+1 -1
View File
@@ -298,7 +298,7 @@ IMPL_LINK_NOARG( PlaceEditDialog, EditHdl, DetailsContainer*, void )
if( nLength < 0 )
nLength = sUser.getLength();
sLabel = sLabel.replaceFirst( "$user$", sUser.copy( 0, nLength ) );
sLabel = sLabel.replaceFirst( "$user$", sUser.subView( 0, nLength ) );
sLabel = sLabel.replaceFirst( "$service$", m_xLBServerType->get_active_text() );
m_xEDServerName->set_text( sLabel );
@@ -287,9 +287,9 @@ OUString PopupMenuControllerBase::determineBaseURL( const OUString& aURL )
{
sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart );
if ( nQueryPart > 0 )
aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart );
aMainURL += aURL.subView( nSchemePart, nQueryPart-nSchemePart );
else if ( nQueryPart == -1 )
aMainURL += aURL.copy( nSchemePart+1 );
aMainURL += aURL.subView( nSchemePart+1 );
}
return aMainURL;
+2 -2
View File
@@ -167,13 +167,13 @@ OUString GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen )
if (nPathPrefixLen >= 0)
{
aReduced = aPath.copy(0, nPathPrefixLen) + "..."
aReduced = OUString::Concat(aPath.subView(0, nPathPrefixLen)) + "..."
+ OUStringChar(aDelimiter) + aName;
}
else
{
aReduced += "..." + OUStringChar(aDelimiter) + "..."
+ aName.copy( aName.getLength() - (nMaxLen - 7) );
+ aName.subView( aName.getLength() - (nMaxLen - 7) );
}
}
else
+1 -1
View File
@@ -961,7 +961,7 @@ OUString SdrTextObj::TakeObjNameSingul() const
if(aStr2.getLength() > 10)
{
aStr2 = aStr2.copy(0, 8) + "...";
aStr2 = OUString::Concat(aStr2.subView(0, 8)) + "...";
}
aStr += aStr2 + "\'";
+1 -1
View File
@@ -121,7 +121,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
{
OUString aStr( OUString::number( rGraphic.GetChecksum(), 16 ) );
if ( aStr[0] == '-' )
aStr = "m" + aStr.copy(1);
aStr = OUString::Concat("m") + aStr.subView(1);
OUString aName = aURL.getBase() + "_" + aURL.getExtension() + "_" + aStr;
aURL.setBase( aName );
}
+1 -1
View File
@@ -524,7 +524,7 @@ std::vector<OUString>& SwDoc::FindUsedDBs( const std::vector<OUString>& rAllDBNa
const sal_Int32 nEndPos = sFormula.indexOf('.', nPos);
if( nEndPos>=0 )
{
rUsedDBNames.emplace_back(sItem + OUStringChar(DB_DELIM) + sFormula.copy( nPos, nEndPos - nPos ));
rUsedDBNames.emplace_back(sItem + OUStringChar(DB_DELIM) + sFormula.subView( nPos, nEndPos - nPos ));
}
}
}

Some files were not shown because too many files have changed in this diff Show More