summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-12-26 10:03:40 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2021-12-26 20:36:26 +0100
commita23a7eea5cfcdc50d09be248828cb1e6293e5ebb (patch)
treee415782b558350673175f80836d022c4882c9a7d /linguistic
parentcc517c687de7205487936d40b64481107656f239 (diff)
Avoid OUStringBuffer::toString where possible
Change-Id: I99abbe97a48b2077e28d6221fb70036e5e412657 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127479 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/hyphdsp.cxx23
1 files changed, 9 insertions, 14 deletions
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 4036d0c2d5b0..17c0bff0e872 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -21,6 +21,9 @@
#include <sal/log.hxx>
#include <algorithm>
+#if OSL_DEBUG_LEVEL > 0
+#include <utility>
+#endif
#include <cppuhelper/factory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -123,23 +126,15 @@ Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord(
{
#if OSL_DEBUG_LEVEL > 0
{
- if (aTmp.toString() != rOrigWord)
+ if (std::u16string_view(aTmp) != rOrigWord)
{
// both words should only differ by a having a trailing '.'
// character or not...
- OUString aShorter, aLonger;
- if (aTmp.getLength() <= rOrigWord.getLength())
- {
- aShorter = aTmp.toString();
- aLonger = rOrigWord;
- }
- else
- {
- aShorter = rOrigWord;
- aLonger = aTmp.toString();
- }
- sal_Int32 nS = aShorter.getLength();
- sal_Int32 nL = aLonger.getLength();
+ std::u16string_view aShorter(aTmp), aLonger(rOrigWord);
+ if (aTmp.getLength() > rOrigWord.getLength())
+ std::swap(aShorter, aLonger);
+ sal_Int32 nS = aShorter.size();
+ sal_Int32 nL = aLonger.size();
if (nS > 0 && nL > 0)
{
assert( ((nS + 1 == nL) && aLonger[nL-1] == '.') && "HyphenatorDispatcher::buildHyphWord: unexpected difference between words!" );