summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 10:13:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 12:12:31 +0200
commit4a96fb8ec0130e1036913093836bcf28bc37a49b (patch)
treee7aad9be4ca417e9e64f688cc99bee0638037741 /tools
parentf33b6e341fb7dd1ab3acd4fe5457b716be316e89 (diff)
loplugin:bufferadd loosen some constraints
and extend O*StringView to have a constructor that takes a pointer and a length Change-Id: I6120e96280f030757e855a6596efdae438b7e1e8 Reviewed-on: https://gerrit.libreoffice.org/80872 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/fsys/urlobj.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 37f3791a4d30..91fe51a9e283 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -4193,12 +4193,11 @@ bool INetURLObject::removeExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash)
if (!pExtension)
return true;
- OUStringBuffer aNewPath;
- aNewPath.append(pPathBegin, pExtension - pPathBegin);
- aNewPath.append(p, pPathEnd - p);
+ OUString aNewPath =
+ rtl::OUStringView(pPathBegin, pExtension - pPathBegin) +
+ rtl::OUStringView(p, pPathEnd - p);
- return setPath(aNewPath.makeStringAndClear(), EncodeMechanism::NotCanonical,
- RTL_TEXTENCODING_UTF8);
+ return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8);
}
bool INetURLObject::hasFinalSlash() const
@@ -4223,12 +4222,9 @@ bool INetURLObject::setFinalSlash()
if (pPathEnd > pPathBegin && pPathEnd[-1] == '/')
return true;
- OUStringBuffer aNewPath;
- aNewPath.append(pPathBegin, pPathEnd - pPathBegin);
- aNewPath.append('/');
+ OUString aNewPath = rtl::OUStringView(pPathBegin, pPathEnd - pPathBegin) + "/";
- return setPath(aNewPath.makeStringAndClear(), EncodeMechanism::NotCanonical,
- RTL_TEXTENCODING_UTF8);
+ return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8);
}
bool INetURLObject::removeFinalSlash()