summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 20:52:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-30 21:21:34 +0200
commitfbff7af0a1a31e82c3a3eb6dac77d5a48ef3371d (patch)
tree2aad7e48c6f7a260e0c3ebf6799fbfb95bb6a210 /dbaccess
parent40077fe30919494f0ecd04c4620cac2334d3d382 (diff)
split comphelper::string::strip functions into String and view version
which is more obvious, from the perspective of the caller, and lets us avoid creating a new String if nothing needs to be stripped Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx7
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx2
3 files changed, 6 insertions, 5 deletions
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 25513b36c952..06eb5545f354 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -19,6 +19,7 @@
#include <dsntypes.hxx>
#include <unotools/confignode.hxx>
+#include <o3tl/safeint.hxx>
#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <tools/wldcrd.hxx>
@@ -84,7 +85,7 @@ OUString ODsnTypeCollection::cutPrefix(std::u16string_view _sURL) const
OUString sOldPattern;
// on Windows or with gen rendering, the urls may begin with an ~
- const OUString& sCleanURL = comphelper::string::stripStart(_sURL, '~');
+ std::u16string_view sCleanURL = comphelper::string::stripStart(_sURL, '~');
for (auto const& dsnPrefix : m_aDsnPrefixes)
{
@@ -95,8 +96,8 @@ OUString ODsnTypeCollection::cutPrefix(std::u16string_view _sURL) const
// foo*
// that is, the very concept of "prefix" applies.
OUString prefix(comphelper::string::stripEnd(dsnPrefix, '*'));
- OSL_ENSURE(prefix.getLength() <= sCleanURL.getLength(), "How can A match B when A shorter than B?");
- sRet = sCleanURL.copy(prefix.getLength());
+ OSL_ENSURE(o3tl::make_unsigned(prefix.getLength()) <= sCleanURL.size(), "How can A match B when A shorter than B?");
+ sRet = sCleanURL.substr(prefix.getLength());
sOldPattern = dsnPrefix;
}
}
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 9533ec087c14..3a25efb0597e 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -882,7 +882,7 @@ namespace
{
OUString stripTrailingDots(std::u16string_view rStr)
{
- return comphelper::string::stripEnd(rStr, '.');
+ return OUString(comphelper::string::stripEnd(rStr, '.'));
}
}
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 42b0d3a7a817..15a482e91cb2 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2172,7 +2172,7 @@ namespace
if ( SQL_ISRULE(pColumnRef,general_set_fct) )
{
aInfo->SetFunctionType(nFunctionType|FKT_AGGREGATE);
- aInfo->SetFunction(comphelper::string::stripEnd(o3tl::getToken(aColumns,0,'('), ' '));
+ aInfo->SetFunction(OUString(comphelper::string::stripEnd(o3tl::getToken(aColumns,0,'('), ' ')));
}
else
aInfo->SetFunctionType(nFunctionType|FKT_OTHER);