i18npool/source/nativenumber/nativenumbersupplier.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit fad5b7b9cf936bf6df49e2ac28977f350db24253
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Jan 27 15:06:43 2021 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Jan 27 17:16:20 2021 +0100

    Use std::u16string_view instead of OUString in one place
    
    ...due to which an upcoming loplugin:stringliteralvar improvement would
    otherwise have suggested to turn the MinusChar array into an 
OUStringLiteral,
    but which would have lead to awkward code elsewhere.  (And the code is a bit
    more efficient this way now anyway, of course.  The remaining
    
      OUString numberChar, multiplierChar, decimalChar, separatorChar;
    
    might benefit from a similar change, but they didn't interfere with the
    loplugin:stringliteralvar improvement, so are left alone at least for now.)
    
    Change-Id: I41e3ef987450cbd29d3663a9aeefda336d798170
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110019
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx 
b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index fd487c7de0ea..66a5655deed7 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -335,11 +335,11 @@ OUString NativeToAscii(const OUString& inStr,
         sal_Int32 count = 0, index;
         sal_Int32 i;
 
-        OUString numberChar, multiplierChar, decimalChar, minusChar, 
separatorChar;
+        OUString numberChar, multiplierChar, decimalChar, separatorChar;
         numberChar = OUString(NumberChar[0], 10*NumberChar_Count);
         multiplierChar = OUString(MultiplierChar_7_CJK[0], 
ExponentCount_7_CJK*Multiplier_Count);
         decimalChar = OUString(DecimalChar, NumberChar_Count);
-        minusChar = OUString(MinusChar, NumberChar_Count);
+        std::u16string_view const minusChar(MinusChar, NumberChar_Count);
         separatorChar = OUString(
             reinterpret_cast<sal_Unicode *>(SeparatorChar), NumberChar_Count);
 
@@ -369,7 +369,7 @@ OUString NativeToAscii(const OUString& inStr,
                     // Only when decimal point is followed by numbers,
                     // it will be convert to ASCII decimal point
                     newStr[count] = DecimalChar[NumberChar_HalfWidth];
-                else if (minusChar.indexOf(str[i]) >= 0 &&
+                else if (minusChar.find(str[i]) != std::u16string_view::npos &&
                         (i < nCount-1 && (numberChar.indexOf(str[i+1]) >= 0 ||
                                           multiplierChar.indexOf(str[i+1]) >= 
0)))
                     // Only when minus is followed by numbers,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to