[Libreoffice-commits] core.git: basctl/source connectivity/source cppuhelper/source cui/source dbaccess/source desktop/source editeng/source idlc/source l10ntools/source sc/source sd/source sfx2/source starmath/source svl/qa svl/source svtools/source svx/source sw/source ucb/source unotools/source vcl/generic vcl/source writerfilter/source xmloff/source
Noel Grandin
noel at peralex.com
Tue Oct 22 23:29:49 PDT 2013
basctl/source/basicide/baside2b.cxx | 2 -
connectivity/source/commontools/dbtools2.cxx | 2 -
cppuhelper/source/bootstrap.cxx | 2 -
cppuhelper/source/paths.cxx | 4 --
cui/source/dialogs/SpellDialog.cxx | 4 +-
dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 2 -
desktop/source/deployment/manager/dp_manager.cxx | 2 -
desktop/source/deployment/registry/dp_backend.cxx | 2 -
editeng/source/outliner/outliner.cxx | 2 -
idlc/source/idlcmain.cxx | 4 +-
l10ntools/source/export.cxx | 2 -
l10ntools/source/lngmerge.cxx | 10 +-----
sc/source/core/data/dputil.cxx | 6 ---
sc/source/core/tool/interpr1.cxx | 4 +-
sc/source/ui/app/inputhdl.cxx | 7 +---
sc/source/ui/docshell/docfunc.cxx | 2 -
sc/source/ui/docshell/docsh.cxx | 2 -
sc/source/ui/docshell/impex.cxx | 5 +--
sd/source/filter/html/htmlex.cxx | 4 +-
sfx2/source/appl/shutdownicon.cxx | 2 -
starmath/source/node.cxx | 4 +-
svl/qa/unit/test_URIHelper.cxx | 2 -
svl/source/passwordcontainer/passwordcontainer.cxx | 8 ++--
svl/source/passwordcontainer/syscreds.cxx | 4 +-
svtools/source/control/inettbc.cxx | 22 ++++++-------
svtools/source/svhtml/htmlsupp.cxx | 6 +--
svtools/source/svhtml/parhtml.cxx | 11 ++----
svx/source/form/formcontroller.cxx | 4 +-
svx/source/sidebar/nbdtmg.cxx | 4 +-
svx/source/tbxctrls/fillctrl.cxx | 30 +++++++++---------
svx/source/tbxctrls/itemwin.cxx | 10 +++---
sw/source/filter/html/htmlfldw.cxx | 9 ++---
sw/source/filter/ww8/ww8par5.cxx | 6 +--
sw/source/ui/dbui/createaddresslistdialog.cxx | 5 +--
sw/source/ui/dbui/mmaddressblockpage.cxx | 2 -
sw/source/ui/lingu/olmenu.cxx | 4 +-
ucb/source/ucp/cmis/cmis_content.cxx | 4 +-
ucb/source/ucp/file/filglob.cxx | 6 +--
ucb/source/ucp/ftp/ftpurl.cxx | 2 -
unotools/source/config/bootstrap.cxx | 4 +-
unotools/source/ucbhelper/tempfile.cxx | 13 +++----
vcl/generic/fontmanager/helper.cxx | 2 -
vcl/source/control/field.cxx | 2 -
vcl/source/filter/FilterConfigItem.cxx | 2 -
vcl/source/filter/sgvtext.cxx | 2 -
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 -
xmloff/source/text/txtfldi.cxx | 4 +-
47 files changed, 111 insertions(+), 133 deletions(-)
New commits:
commit 7a06928bcf638e1eeedebc9d53c306a1b852cc9b
Author: Noel Grandin <noel at peralex.com>
Date: Mon Oct 21 10:21:01 2013 +0200
convert code to use OUString::endsWith
Convert places that call
aStr[aStr.getLength()-1] == 'x'
to use the shorter form
aStr.endsWith("x")
Change-Id: I1b3a19c0e89b8989cdbeed440f95fc76f9a4b6b6
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 5e23916..485d696 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -727,7 +727,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
if( aPortions.empty() )
return;
- if( aLine.getLength() > 0 && aLine[aLine.getLength()-1] != '"' && (aPortions.back().tokenType != TT_STRING) )
+ if( aLine.getLength() > 0 && !aLine.endsWith("\"") && (aPortions.back().tokenType != TT_STRING) )
{
GetEditView()->InsertText(OUString("\""));
//leave the cursor on it's place: inside the two double quotes
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 233d249..2dcb23d 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -263,7 +263,7 @@ namespace
}
if ( nColCount )
- sSql = sSql.replaceAt(sSql.getLength()-1,1,OUString(")"));
+ sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")");
return sSql;
}
}
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 81d3420..6522f72 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -111,7 +111,7 @@ Reference< XComponentContext > SAL_CALL bootstrap()
throw BootstrapException(
"cannot convert soffice installation path to URL!");
}
- if (!path.isEmpty() && path[path.getLength() - 1] != '/') {
+ if (!path.isEmpty() && !path.endsWith("/")) {
path += "/";
}
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index 41abeb4..5ff356f 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -129,9 +129,7 @@ void cppu::decodeRdbUri(rtl::OUString * uri, bool * optional, bool * directory)
if (*optional) {
*uri = uri->copy(1);
}
- *directory = uri->getLength() >= 3 && (*uri)[0] == '<'
- && (*uri)[uri->getLength() - 2] == '>'
- && (*uri)[uri->getLength() - 1] == '*';
+ *directory = uri->startsWith("<") && uri->endsWith(">*");
if (*directory) {
*uri = uri->copy(1, uri->getLength() - 3);
}
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index d32a172..8c7c59c 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -524,11 +524,11 @@ namespace
OUString aString = rErrorText;
//dots are sometimes part of the spelled word but they are not necessarily part of the replacement
- bool bDot = !aString.isEmpty() && aString[aString.getLength() - 1] == '.';
+ bool bDot = aString.endsWith(".");
aString = rSuggestedReplacement;
- if(bDot && (aString.isEmpty() || aString[aString.getLength() - 1] != '.'))
+ if(bDot && (aString.isEmpty() || !aString.endsWith(".")))
aString += ".";
return aString;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 0ae0859..c368cf0 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1127,7 +1127,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
case DataType::CLOB:
- if(aText[0] != '\'' || aText[aText.getLength() -1] != '\'')
+ if(!aText.startsWith("'") || !aText.endsWith("'"))
{
aText = aText.replaceAll("'", "''");
aText = "'" + aText + "'";
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 309b32d..bc286bf 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -1325,7 +1325,7 @@ bool PackageManagerImpl::synchronizeAddedExtensions(
bool bShared = (m_context == "shared");
if (bShared)
{
- OSL_ASSERT(title2[title2.getLength() -1] == '_');
+ OSL_ASSERT(title2.endsWith("_"));
title2 = title2.copy(0, title2.getLength() -1);
}
OUString titleEncoded = ::rtl::Uri::encode(
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 3989284..41daf4a 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -238,7 +238,7 @@ void PackageRegistryBackend::deleteTempFolder(
erase_path( folderUrl, Reference<XCommandEnvironment>(),
false /* no throw: ignore errors */ );
- if (folderUrl[folderUrl.getLength() - 1] == '_')
+ if (folderUrl.endsWith("_"))
{
const OUString tempFile = folderUrl.copy(0, folderUrl.getLength() - 1);
erase_path( tempFile, Reference<XCommandEnvironment>(),
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index ecfca03..a8e3d66 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -439,7 +439,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara )
{
OUString aText(convertLineEnd(rText, LINEEND_LF));
- if (aText[aText.getLength()-1] == '\x0A')
+ if (aText.endsWith("\x0A"))
aText = aText.copy(0, aText.getLength()-1); // Delete the last break
sal_uInt16 nCount = comphelper::string::getTokenCount(aText, '\x0A');
diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx
index fbec6de..1bff708 100644
--- a/idlc/source/idlcmain.cxx
+++ b/idlc/source/idlcmain.cxx
@@ -67,7 +67,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
OString outputUrl;
if (options.isValid("-O")) {
outputUrl = convertToFileUrl(options.getOption("-O"));
- if (outputUrl[outputUrl.getLength() - 1] != '/') {
+ if (!outputUrl.endsWith("/")) {
outputUrl += "/";
}
outputUrl += "stdin.urd";
@@ -112,7 +112,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
if ( options.isValid("-O") )
{
outputFile = (options.getOption("-O"));
- if ('/' != outputFile.getStr()[outputFile.getLength()-1]) {
+ if (!outputFile.endsWith("/")) {
outputFile += OString('/');
}
outputFile += strippedFileName.replaceAt(
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index f68cf29..8b44727 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -933,7 +933,7 @@ sal_Bool Export::WriteExportList(ResData *pResData, ExportList *pExportList,
else {
sGID += ".";
sGID += pResData->sId;
- while (!sGID.isEmpty() && sGID[sGID.getLength() - 1] == '.') {
+ while (sGID.endsWith(".")) {
sGID = sGID.copy(0, sGID.getLength() - 1);
}
}
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index bed6c93..4913bc4 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -138,7 +138,7 @@ void LngParser::WritePO(PoOfstream &aPOStream,
bool LngParser::isNextGroup(OString &sGroup_out, const OString &sLine_in)
{
const OString sLineTrim = sLine_in.trim();
- if ((sLineTrim[0] == '[') && (sLineTrim[sLineTrim.getLength() - 1] == ']'))
+ if (sLineTrim.startsWith("[") && sLineTrim.endsWith("]"))
{
sGroup_out = getBracketedContent(sLineTrim).trim();
return true;
@@ -184,9 +184,7 @@ sal_Bool LngParser::Merge(
{
OString sLine( *(*pLines)[ nPos ] );
sLine = sLine.trim();
- if (!sLine.isEmpty() &&
- ( sLine[0] == '[' ) &&
- ( sLine[sLine.getLength() - 1] == ']' ))
+ if ( sLine.startsWith("[") && sLine.endsWith("]") )
{
sGroup = getBracketedContent(sLine).trim();
bGroup = sal_True;
@@ -211,9 +209,7 @@ sal_Bool LngParser::Merge(
{
OString sLine( *(*pLines)[ nPos ] );
sLine = sLine.trim();
- if (!sLine.isEmpty() &&
- ( sLine[0] == '[' ) &&
- ( sLine[sLine.getLength() - 1] == ']' ))
+ if ( sLine.startsWith("[") && sLine.endsWith("]") )
{
sGroup = getBracketedContent(sLine).trim();
bGroup = sal_True;
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index 3e4a290..fd15d4e 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -56,11 +56,7 @@ OUString getSpecialDateName(double fValue, bool bFirst, SvNumberFormatter* pForm
bool ScDPUtil::isDuplicateDimension(const OUString& rName)
{
- if (rName.isEmpty())
- return false;
-
- sal_Unicode cLast = rName[rName.getLength()-1];
- return cLast == sal_Unicode('*');
+ return rName.endsWith("*");
}
OUString ScDPUtil::getSourceDimensionName(const OUString& rName)
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index ab792b5..04c484f 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7192,7 +7192,7 @@ void ScInterpreter::ScAddressFunc()
}
/* TODO: yet unsupported external reference in CONV_XL_R1C1 syntax may
* need some extra handling to isolate Tab from Doc. */
- if (sTabStr[0] != '\'' || sTabStr[sTabStr.getLength()-1] != '\'')
+ if (sTabStr[0] != '\'' || !sTabStr.endsWith("'"))
ScCompiler::CheckTabQuotes( sTabStr, eConv);
if (!aDoc.isEmpty())
sTabStr = aDoc + sTabStr;
@@ -8329,7 +8329,7 @@ bool ScInterpreter::MayBeRegExp( const OUString& rStr, const ScDocument* pDoc )
{
if ( pDoc && !pDoc->GetDocOptions().IsFormulaRegexEnabled() )
return false;
- if ( rStr.isEmpty() || (rStr.getLength() == 1 && rStr[0] != '.') )
+ if ( rStr.isEmpty() || (rStr.getLength() == 1 && !rStr.startsWith(".")) )
return false; // single meta characters can not be a regexp
static const sal_Unicode cre[] = { '.','*','+','?','[',']','^','$','\\','<','>','(',')','|', 0 };
const sal_Unicode* p1 = rStr.getStr();
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 20634c9..209308e 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1426,7 +1426,7 @@ void ScInputHandler::PasteManualTip()
if ( aInsert[0] == '"' )
aInsert = aInsert.copy(1);
xub_StrLen nInsLen = aInsert.getLength();
- if ( nInsLen && aInsert[nInsLen-1] == '"' )
+ if ( aInsert.endsWith("\"") )
aInsert = aInsert.copy( 0, nInsLen-1 );
}
else if ( aSel.nEndPos )
@@ -2056,10 +2056,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
else
aStr = GetEditText(pEngine);
- if (aStr.getLength() > 3 && // Matrix-Formel ?
- aStr[0] == '{' &&
- aStr[1] == '=' &&
- aStr[aStr.getLength()-1] == '}')
+ if (aStr.startsWith("{=") && aStr.endsWith("}") ) // Matrix-Formel ?
{
aStr = aStr.copy(1, aStr.getLength() -2);
pEngine->SetText(aStr);
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 5f1c8cb..9f2195e 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5191,7 +5191,7 @@ sal_Bool ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNe
OUString aFormula;
pDoc->GetFormula( nStartCol, nStartRow, nTab, aFormula );
- if ( aFormula[0] == '{' && aFormula[aFormula.getLength()-1] == '}' )
+ if ( aFormula.startsWith("{") && aFormula.endsWith("}") )
{
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_RESIZEMATRIX );
if (bUndo)
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 9d1efe0..51f8544 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2012,7 +2012,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_Unicode c = aUniString[0];
bString = (c == cStrDelim || c == ' ' ||
- aUniString[aUniString.getLength()-1] == ' ' ||
+ aUniString.endsWith(" ") ||
aUniString.indexOf(cStrDelim) >= 0);
if (!bString && cDelim != 0)
bString = (aUniString.indexOf(cDelim) >= 0);
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 93f9782..fccafbe 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2022,9 +2022,8 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
* writes in SYLK. */
}
if ( pFCell->GetMatrixFlag() != MM_NONE &&
- aCellStr.getLength() > 2 &&
- aCellStr[0] == '{' &&
- aCellStr[aCellStr.getLength()-1] == '}' )
+ aCellStr.startsWith("{") &&
+ aCellStr.endsWith("}") )
{ // cut off matrix {} characters
aCellStr = aCellStr.copy(1, aCellStr.getLength()-2);
}
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 013d50d..4e6ad03 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -855,7 +855,7 @@ void HtmlExport::ExportWebCast()
if (maCGIPath.isEmpty())
maCGIPath = ".";
- if (maCGIPath[maCGIPath.getLength() - 1] != '/')
+ if (!maCGIPath.endsWith("/"))
maCGIPath += "/";
if( meScript == SCRIPT_ASP )
@@ -867,7 +867,7 @@ void HtmlExport::ExportWebCast()
if (maURLPath.isEmpty())
maURLPath = ".";
- if (maURLPath[maURLPath.getLength() - 1] != '/')
+ if (!maURLPath.endsWith("/"))
maURLPath += "/";
}
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index bafa7c2..201a153 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -525,7 +525,7 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR
else
{
OUString aBaseDirURL = sFiles[0];
- if ( !aBaseDirURL.isEmpty() && aBaseDirURL[aBaseDirURL.getLength()-1] != '/' )
+ if ( !aBaseDirURL.isEmpty() && !aBaseDirURL.endsWith("/") )
aBaseDirURL += "/";
int iFiles;
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 2e631e2..d8832a5 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -802,8 +802,8 @@ void SmExpressionNode::CreateTextFromNode(OUString &rText)
pNode->CreateTextFromNode(rText);
//Just a bit of foo to make unary +asd -asd +-asd -+asd look nice
if (pNode->GetType() == NMATH)
- if ((nSize != 2) || ((rText[rText.getLength()-1] != '+') &&
- (rText[rText.getLength()-1] != '-')))
+ if ((nSize != 2) ||
+ ( !rText.endsWith("+") && !rText.endsWith("-") ))
rText += " ";
}
diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx
index 3d160d6..313ce65 100644
--- a/svl/qa/unit/test_URIHelper.cxx
+++ b/svl/qa/unit/test_URIHelper.cxx
@@ -162,7 +162,7 @@ css::uno::Any Content::execute(
uri += "/";
break;
case '2':
- if (uri.getLength() > 0 && uri[uri.getLength() - 1] == '/') {
+ if (uri.endsWith("/")) {
uri = uri.copy(0, uri.getLength() -1);
}
break;
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 8c4f7d2..ad99f8b 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -788,8 +788,8 @@ UrlRecord PasswordContainer::find(
else
{
OUString tmpUrl( aUrl );
- if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
- tmpUrl += OUString("/");
+ if ( !tmpUrl.endsWith("/") )
+ tmpUrl += "/";
aIter = m_aContainer.lower_bound( tmpUrl );
if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) )
@@ -919,7 +919,7 @@ void SAL_CALL PasswordContainer::remove( const OUString& aURL, const OUString& a
if( aInd > 0 && aUrl.getLength()-1 == aInd )
aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
else
- aUrl += OUString("/");
+ aUrl += "/";
aIter = m_aContainer.find( aUrl );
}
@@ -960,7 +960,7 @@ void SAL_CALL PasswordContainer::removePersistent( const OUString& aURL, const O
if( aInd > 0 && aUrl.getLength()-1 == aInd )
aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
else
- aUrl += OUString("/");
+ aUrl += "/";
aIter = m_aContainer.find( aUrl );
}
diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx
index 9423acf..5bd60dc 100644
--- a/svl/source/passwordcontainer/syscreds.cxx
+++ b/svl/source/passwordcontainer/syscreds.cxx
@@ -141,8 +141,8 @@ namespace
else
{
OUString tmpUrl( aUrl );
- if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
- tmpUrl += OUString("/");
+ if ( !tmpUrl.endsWith("/") )
+ tmpUrl += "/";
aIter = rContainer.lower_bound( tmpUrl );
if( aIter != rContainer.end() && aIter->match( tmpUrl ) )
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 00dbfbb..ec9de0d 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -240,7 +240,7 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, )
// note: if this doesn't work, we're not interested in: we're checking the
// untouched sCompletion then
- if ( !sURL.isEmpty() && ( sURL[sURL.getLength()-1] != '/' ))
+ if ( !sURL.isEmpty() && !sURL.endsWith("/") )
{
OUString sUpperURL( sURL.toAsciiUpperCase() );
@@ -316,9 +316,9 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
#endif
sal_Bool bExectMatch = bPureHomePath
- || aText.compareTo( "." ) == 0
- || (aText.getLength() > 1 && aText.copy( aText.getLength() - 2, 2 ).compareTo( "/." ) == 0)
- || (aText.getLength() > 2 && aText.copy( aText.getLength() - 3, 3 ).compareTo( "/.." ) == 0);
+ || aText == "."
+ || aText.endsWith("/.")
+ || aText.endsWith("/..");
// for pure home paths ( ~username ) the '.' at the end of rMatch
// means that it poits to root catalog
@@ -346,7 +346,7 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
aMatchName = aMatchName.toAsciiLowerCase();
// if the matchstring ends with a slash, we must search for this also
- if ( rMatch[ rMatch.getLength()-1 ] == '/' )
+ if ( rMatch.endsWith("/") )
aMatchName += "/";
}
@@ -435,7 +435,7 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
OUString aInput( aText );
if ( nMatchLen )
{
- if ((aText.getLength() && aText[ aText.getLength() - 1 ] == '.') || bPureHomePath)
+ if (aText.endsWith(".") || bPureHomePath)
{
// if a "special folder" URL was typed, don't touch the user input
aMatch = aMatch.copy( nMatchLen );
@@ -508,7 +508,7 @@ OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, const OUStrin
// HRO: INetURLObject::smatRel2Abs does not recognize '\\' as a relative path
// but in case of "\\\\" INetURLObject is right - this is an absolute path !
- if( aText.indexOf( '\\' ) == 0 && (aText.getLength() < 2 || aText[ 1 ] != '\\') )
+ if( aText.startsWith("\\") && (aText.getLength() < 2 || aText[ 1 ] != '\\') )
{
// cut to first segment
OUString aTmp = INetURLObject::GetScheme( eBaseProt );
@@ -535,7 +535,7 @@ OUString SvtURLBox::ParseSmart( OUString aText, OUString aBaseURL, const OUStrin
INetURLObject aTmp( aObj.smartRel2Abs( aSmart, bWasAbsolute ) );
#endif
- if ( aText[ aText.getLength() - 1 ] == '.' )
+ if ( aText.endsWith(".") )
// INetURLObject appends a final slash for the directories "." and "..", this is a bug!
// Remove it as a workaround
aTmp.removeFinalSlash();
@@ -788,7 +788,7 @@ void SvtMatchContext_Impl::doExecute()
if( bFull )
continue;
- if( aText.compareTo( aCurMainURL, aText.getLength() ) == 0 )
+ if( aCurMainURL.startsWith(aText) )
{
if( aText.getLength() < aCurMainURL.getLength() )
Insert( aCurMainURL, aCurMainURL );
@@ -978,7 +978,7 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
if ( !aURL.isEmpty() )
{
- sal_Bool bFound = aURL[aURL.getLength()-1] == '/' ;
+ sal_Bool bFound = aURL.endsWith("/");
if ( !bFound )
{
OUString aUpperURL( aURL );
@@ -1363,7 +1363,7 @@ sal_Bool SvtURLBox_Impl::TildeParsing(
}
else
{
- if( aParseTilde[ aParseTilde.getLength() - 1 ] != '/' )
+ if( !aParseTilde.endsWith("/") )
aParseTilde += "/";
if( aText.getLength() > 2 )
aParseTilde += aText.copy( 2 );
diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx
index 829e8f3..f1de1c0 100644
--- a/svtools/source/svhtml/htmlsupp.cxx
+++ b/svtools/source/svhtml/htmlsupp.cxx
@@ -96,8 +96,7 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, sal_Bool bFull )
// remove SGML comments
- if( rString.getLength() >= 4 &&
- rString.startsWith( "<!--" ) )
+ if( rString.startsWith( "<!--" ) )
{
sal_Int32 nPos = 3;
if( bFull )
@@ -117,8 +116,7 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, sal_Bool bFull )
rString = rString.copy( nPos, rString.getLength() - nPos );
}
- if( rString.getLength() >=3 &&
- rString.endsWith("-->") )
+ if( rString.endsWith("-->") )
{
rString = rString.copy( 0, rString.getLength()-3 );
if( bFull )
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index b729259..dd90ac3 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -907,8 +907,7 @@ int HTMLParser::_GetNextRawToken()
: aTok.compareTo(aEndToken) );
}
}
- if( bReadComment && '>'==nNextCh && aTok.getLength() >= 2 &&
- aTok.endsWith( "--" ) )
+ if( bReadComment && '>'==nNextCh && aTok.endsWith( "--" ) )
{
// End of comment of style <!----->
bReadComment = false;
@@ -1214,8 +1213,7 @@ int HTMLParser::_GetNextToken()
// generate pending HTML_<TOKEN>_OFF for HTML_<TOKEN>_ON
// Do not convert this to a single HTML_<TOKEN>_OFF
// which lead to fdo#56772.
- if ((HTML_TOKEN_ONOFF & nRet) && (aToken.getLength() >= 1) &&
- ('/' == aToken[aToken.getLength()-1]))
+ if ((HTML_TOKEN_ONOFF & nRet) && aToken.endsWith("/"))
{
mnPendingOffToken = nRet + 1; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF
aToken = aToken.replaceAt( aToken.getLength()-1, 1, ""); // remove trailing '/'
@@ -1275,8 +1273,7 @@ int HTMLParser::_GetNextToken()
// Read until closing %>. If not found restart at first >.
while( !bDone && !rInput.IsEof() && IsParserWorking() )
{
- bDone = '>'==nNextCh && aToken.getLength() >= 1 &&
- '%' == aToken[ aToken.getLength()-1 ];
+ bDone = '>'==nNextCh && aToken.endsWith("%");
if( !bDone )
{
aToken += OUString(nNextCh);
@@ -2127,7 +2124,7 @@ bool HTMLParser::ParseMetaOptionsImpl(
if ( bHTTPEquiv && i_pHTTPHeader )
{
// Netscape seems to just ignore a closing ", so we do too
- if ( !aContent.isEmpty() && '"' == aContent[ aContent.getLength()-1 ] )
+ if ( aContent.endsWith("\"") )
{
aContent = aContent.copy( 0, aContent.getLength() - 1 );
}
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index cb21a59..dcd2b18 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -3220,10 +3220,10 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
if (aRow.find((*iter).xText) != aRow.end())
{
OUString aCompText = aRow[(*iter).xText];
- aCompText += OUString(" ");
+ aCompText += " ";
OString aVal = m_xParser->getContext().getIntlKeywordAscii(IParseContext::KEY_AND);
aCompText += OUString(aVal.getStr(),aVal.getLength(),RTL_TEXTENCODING_ASCII_US);
- aCompText += OUString(" ");
+ aCompText += " ";
aCompText += ::comphelper::getString(pRefValues[j].Value);
aRow[(*iter).xText] = aCompText;
}
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index da61e05..fbe446a 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -1834,8 +1834,8 @@ sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uIn
aFmt.SetBulletFont( &rActBulletFont );
sal_Unicode cChar = 0;
- if( pLevelSettings->sBulletChar.getLength() )
- cChar = pLevelSettings->sBulletChar.getStr()[0];
+ if( !pLevelSettings->sBulletChar.isEmpty() )
+ cChar = pLevelSettings->sBulletChar[0];
if( Application::GetSettings().GetLayoutRTL() )
{
if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] )
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index e8b45dc..499bccf 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -28,8 +28,8 @@
#define DELAY_TIMEOUT 300
-#define TMP_STR_BEGIN '['
-#define TMP_STR_END ']'
+#define TMP_STR_BEGIN "["
+#define TMP_STR_END "]"
#include "svx/drawitem.hxx"
#include "svx/xattr.hxx"
@@ -259,13 +259,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary color
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
//pFillAttrLB->SetUpdateMode( sal_False );
sal_uInt16 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr );
@@ -293,13 +293,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr );
XGradientList aGradientList( "" );
@@ -338,13 +338,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr );
XHatchList aHatchList( "" );
@@ -390,13 +390,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XBitmapEntry* pEntry = new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr);
XBitmapListRef xBitmapList =
@@ -673,7 +673,7 @@ IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox )
{
// Entry gets tested against temporary color
OUString aTmpStr = pLbFillAttr->GetSelectEntry();
- if( aTmpStr[0] == TMP_STR_BEGIN && aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) && aTmpStr.endsWith(TMP_STR_END) )
{
aTmpStr = aTmpStr.copy(1, aTmpStr.getLength()-2);
}
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 6435eaa..3d10cb3 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -28,8 +28,8 @@
#include <svx/dialogs.hrc>
-#define TMP_STR_BEGIN '['
-#define TMP_STR_END ']'
+#define TMP_STR_BEGIN "["
+#define TMP_STR_END "]"
#define DELAY_TIMEOUT 100
@@ -318,13 +318,13 @@ void SvxColorBox::Update( const XLineColorItem* pItem )
{
// Last entry gets tested against temporary color
aTmpStr = GetEntry( nCount - 1 );
- if( aTmpStr[0] == TMP_STR_BEGIN &&
- aTmpStr[aTmpStr.getLength()-1] == TMP_STR_END )
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
{
RemoveEntry( nCount - 1 );
}
}
- aTmpStr = OUString(TMP_STR_BEGIN) + aString + OUString(TMP_STR_END);
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
sal_uInt16 nPos = InsertEntry( aColor, aTmpStr );
SelectEntryPos( nPos );
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index ceca418..8a3f247 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -464,10 +464,9 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt )
const OUString& rComment = pFld->GetPar2();
sal_Bool bWritten = sal_False;
- if( (rComment.getLength() >= 6 && '<' == rComment[0] &&
- '>' == rComment[rComment.getLength()-1] &&
- rComment.copy( 1, 4 ).equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_meta) ) ||
- (rComment.getLength() >= 7 &&
+ if( (rComment.getLength() >= 6 && rComment.startsWith("<") && rComment.endsWith(">") &&
+ rComment.copy( 1, 4 ).equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_meta) ) ||
+ (rComment.getLength() >= 7 &&
rComment.startsWith( "<!--" ) &&
rComment.endsWith( "-->" )) )
{
@@ -481,7 +480,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt )
bWritten = sal_True;
}
else if( rComment.getLength() >= 7 &&
- '>' == rComment[rComment.getLength()-1] &&
+ rComment.endsWith(">") &&
rComment.startsWithIgnoreAsciiCase( "HTML:" ) )
{
OUString sComment(comphelper::string::stripStart(rComment.copy(5), ' '));
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index af740e6..2ce43f2 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -219,7 +219,7 @@ OUString SwWW8ImplReader::ConvertFFileName(const OUString& rOrg)
aName = aName.replaceAll("%20", OUString(' '));
// remove attached quotation marks
- if (!aName.isEmpty() && '"' == aName[aName.getLength()-1])
+ if (aName.endsWith("\""))
aName = aName.copy(0, aName.getLength()-1);
// Need the more sophisticated url converter.
@@ -2107,7 +2107,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr)
? true : false;
bNewVText = false;
}
- else if( aVText[aVText.getLength()-1] == ']' )
+ else if( aVText.endsWith("]") )
bBracket = false;
}
break;
@@ -3335,7 +3335,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr
if ( aReadParam.SkipToNextToken()==-2 )
{
sMark = aReadParam.GetResult();
- if( !sMark.isEmpty() && '"' == sMark[ sMark.getLength()-1 ])
+ if( sMark.endsWith("\""))
sMark = sMark.copy( 0, sMark.getLength() - 1 );
}
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
index 00f5761..0995300 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -421,7 +421,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog(
{
OUString sHeader = sLine.getToken( 0, '\t', nIndex );
OSL_ENSURE(sHeader.getLength() > 2 &&
- sHeader[0] == '\"' && sHeader[sHeader.getLength() - 1] == '\"',
+ sHeader.startsWith("\"") && sHeader.endsWith("\""),
"Wrong format of header");
if(sHeader.getLength() > 2)
{
@@ -438,8 +438,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog(
for( sal_Int32 nToken = 0; nToken < nDataCount; ++nToken)
{
OUString sData = sLine.getToken( 0, '\t', nIndex );
- OSL_ENSURE(sData.getLength() >= 2 &&
- sData[0] == '\"' && sData[sData.getLength() - 1] == '\"',
+ OSL_ENSURE( sData.startsWith("\"") && sData.endsWith("\""),
"Wrong format of line");
if(sData.getLength() >= 2)
aNewData.push_back(sData.copy(1, sData.getLength() - 2));
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index b46640a..94b9ec9 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1354,7 +1354,7 @@ void AddressMultiLineEdit::SetText( const OUString& rStr )
{
xub_StrLen nIndex = 0;
OUString sPara = pTextEngine->GetText( nPara );
- if(!sPara.isEmpty() && sPara[sPara.getLength() - 1] != ' ')
+ if(!sPara.isEmpty() && !sPara.endsWith(" "))
{
TextPaM aPaM(nPara, sPara.getLength());
pTextEngine->ReplaceText(TextSelection( aPaM ), OUString(' '));
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index 474179b..687d9a2 100644
--- a/sw/source/ui/lingu/olmenu.cxx
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -677,8 +677,8 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
// if orginal word has a trailing . (likely the end of a sentence)
// and the replacement text hasn't, then add it to the replacement
if (!aTmp.isEmpty() && !aOrig.isEmpty() &&
- '.' == aOrig[ aOrig.getLength() - 1] && /* !IsAlphaNumeric ??*/
- '.' != aTmp[ aTmp.getLength() - 1])
+ aOrig.endsWith(".") && /* !IsAlphaNumeric ??*/
+ !aTmp.endsWith("."))
{
aTmp += ".";
}
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 8159018..d7987c6 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -569,7 +569,7 @@ namespace cmis
OUString sPath = m_sObjectPath;
// Get rid of the trailing slash problem
- if ( sPath[ sPath.getLength( ) - 1 ] == '/' )
+ if ( sPath.endsWith("/") )
sPath = sPath.copy( 0, sPath.getLength() - 1 );
// Get the last segment
@@ -1862,7 +1862,7 @@ namespace cmis
URL aUrl( m_sURL );
OUString sPath( m_sObjectPath );
- if ( sPath[sPath.getLength( ) - 1] != '/' )
+ if ( !sPath.endsWith("/") )
sPath += "/";
sPath += STD_TO_OUSTR( ( *it )->getName( ) );
OUString sId = STD_TO_OUSTR( ( *it )->getId( ) );
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index e217287..e830a5e 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -199,11 +199,11 @@ namespace fileaccess {
sal_Int32 lastIndex = aFileName.lastIndexOf( sal_Unicode('/') );
OUString aParent = aFileName.copy( 0,lastIndex );
- if( aParent[ aParent.getLength()-1] == sal_Unicode(':') && aParent.getLength() == 6 )
- aParent += OUString("/");
+ if( aParent.endsWith(":") && aParent.getLength() == 6 )
+ aParent += "/";
if ( aParent == "file://" )
- aParent = OUString("file:///");
+ aParent = "file:///";
return aParent;
}
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index 70c15c4..ba0e298 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -278,7 +278,7 @@ OUString FTPURL::ident(bool withslash,bool internal) const
else
bff.append(sal_Unicode('/')).append(m_aPathSegmentVec[i]);
if(withslash)
- if(!bff.isEmpty() && bff[bff.getLength()-1] != sal_Unicode('/'))
+ if(!bff.isEmpty() && bff[bff.getLength()-1] != '/')
bff.append(sal_Unicode('/'));
bff.append(m_aType);
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index fb213a3..f05e204 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -209,7 +209,7 @@ bool implNormalizeURL(OUString & _sURL, osl::DirectoryItem& aDirItem)
// #109863# sal/osl returns final slash for file URLs contradicting
// the URL/URI RFCs.
- if ( aNormalizedURL.getStr()[aNormalizedURL.getLength()-1] != cURLSeparator )
+ if ( !aNormalizedURL.endsWith(OUString(cURLSeparator)) )
_sURL = aNormalizedURL;
else
_sURL = aNormalizedURL.copy( 0, aNormalizedURL.getLength()-1 );
@@ -326,7 +326,7 @@ PathStatus getDerivedPath(
// do we have a base path ?
if (!_aBaseURL.isEmpty())
{
- OSL_PRECOND(_aBaseURL[_aBaseURL.getLength()-1] != cURLSeparator,"Unexpected: base URL ends in slash");
+ OSL_PRECOND(!_aBaseURL.endsWith(OUString(cURLSeparator)), "Unexpected: base URL ends in slash");
sDerivedURL = OUStringBuffer(_aBaseURL).append(cURLSeparator).append(_sRelativeURL).makeStringAndClear();
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 13128b6..0ffae6d 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -64,11 +64,11 @@ OUString getParentName( const OUString& aFileName )
sal_Int32 lastIndex = aFileName.lastIndexOf( sal_Unicode('/') );
OUString aParent = aFileName.copy( 0, lastIndex );
- if( aParent[ aParent.getLength()-1] == sal_Unicode(':') && aParent.getLength() == 6 )
- aParent += OUString("/");
+ if( aParent.endsWith(":") && aParent.getLength() == 6 )
+ aParent += "/";
if( 0 == aParent.compareToAscii( "file://" ) )
- aParent = OUString("file:///");
+ aParent = "file:///";
return aParent;
}
@@ -80,7 +80,7 @@ bool ensuredir( const OUString& rUnqPath )
return false;
// remove trailing slash
- if ( rUnqPath[ rUnqPath.getLength() - 1 ] == sal_Unicode( '/' ) )
+ if ( rUnqPath.endsWith("/") )
aPath = rUnqPath.copy( 0, rUnqPath.getLength() - 1 );
else
aPath = rUnqPath;
@@ -172,8 +172,7 @@ OUString ConstructTempDir_Impl( const OUString* pParent )
}
// Make sure that directory ends with a separator
- sal_Int32 i = aName.getLength();
- if( i>0 && aName[i-1] != '/' )
+ if( !aName.isEmpty() && !aName.endsWith("/") )
aName += "/";
return aName;
@@ -434,7 +433,7 @@ OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName )
OUString aUnqPath( rBaseName );
// remove trailing slash
- if ( rBaseName[ rBaseName.getLength() - 1 ] == sal_Unicode( '/' ) )
+ if ( rBaseName.endsWith("/") )
aUnqPath = rBaseName.copy( 0, rBaseName.getLength() - 1 );
// try to create the directory
diff --git a/vcl/generic/fontmanager/helper.cxx b/vcl/generic/fontmanager/helper.cxx
index 6d99dca..bf09d60 100644
--- a/vcl/generic/fontmanager/helper.cxx
+++ b/vcl/generic/fontmanager/helper.cxx
@@ -358,7 +358,7 @@ void psp::normPath( OString& rPath )
// on many different platforms let's play it safe
OString aPath = rPath.replaceAll("//", "/");
- if( !aPath.isEmpty() && aPath[aPath.getLength()-1] == '/' )
+ if( aPath.endsWith("/") )
aPath = aPath.copy(0, aPath.getLength()-1);
if( ( aPath.indexOf("./") != -1 ||
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 401f0a1..4492147 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -118,7 +118,7 @@ static bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
// negative?
if ( bCurrency )
{
- if ( aStr[0] == '(' && aStr[aStr.getLength()-1] == ')' )
+ if ( aStr.startsWith("(") && aStr.endsWith(")") )
bNegative = true;
if ( !bNegative )
{
diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx
index da328f2..f639635 100644
--- a/vcl/source/filter/FilterConfigItem.cxx
+++ b/vcl/source/filter/FilterConfigItem.cxx
@@ -51,7 +51,7 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory >& rXCfgProv, co
if ( rTree[0] == '/' )
++i;
- if ( rTree[rTree.getLength() - 1] == '/' )
+ if ( rTree.endsWith("/") )
--nTokenCount;
Any aAny;
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx
index 3cadc83..113cfff 100644
--- a/vcl/source/filter/sgvtext.cxx
+++ b/vcl/source/filter/sgvtext.cxx
@@ -1134,7 +1134,7 @@ void SgfFontOne::ReadOne( const OString& rID, OString& Dsc )
if ( Dsc.getLength() < 2 || ( Dsc[Dsc.getLength() - 1] !=')' ) )
return;
- i=Dsc.getLength()-2; // hier ist die ')' des SV-Fontnames
+ i = Dsc.getLength()-2; // hier ist die ')' des SV-Fontnames
sal_Int32 j=0;
while ( i > 0 && ( Dsc[i] != '(' ) )
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2150362..0ae63e6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2217,7 +2217,7 @@ void FieldContext::AppendCommand(const OUString& rPart)
bInStringNext = true;
sToken = sToken.copy(1);
}
- if (sToken.getStr()[sToken.getLength() - 1] == '"')
+ if (sToken.endsWith("\""))
{
bInStringNext = false;
sToken = sToken.copy(0, sToken.getLength() - 1);
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 27c6373..74bcc18 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -1042,12 +1042,12 @@ void XMLPlaceholderFieldImportContext::PrepareField(
OUString aContent = GetContent();
sal_Int32 nStart = 0;
sal_Int32 nLength = aContent.getLength();
- if ((nLength > 0) && (aContent.getStr()[0] == '<'))
+ if (aContent.startsWith("<"))
{
--nLength;
++nStart;
}
- if ((nLength > 0) && (aContent.getStr()[aContent.getLength()-1] == '>'))
+ if (aContent.endsWith(">"))
{
--nLength;
}
More information about the Libreoffice-commits
mailing list