[Libreoffice-commits] core.git: sw/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 19 06:31:38 UTC 2021


 sw/source/core/unocore/unoidx.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 075ae953e3e673dedcb74d693e516a07b0bebca2
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Apr 15 14:22:27 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Apr 19 08:31:03 2021 +0200

    Fix two string matches to not include the trailing NULs
    
    ...which had apparently been broken ever since they got introduced with
    399fb822ef81bd2440da8ab48cc2028a6b44d5b7 "swunolocking1: #i105557#: fix locking
    for SwXDocumentIndex".  (The first mis-use of sizeof had already been silently
    fixed with 46ce0d28b4c765076c7871358375c4e85e44534b "loplugin:stringliteralvar
    look for assignments".  And we can now use the OUString::match overloads that
    take const char arrays, instead of using OUString::matchAsciiL, and simplify the
    first one even further to use OUString::startsWith.)
    
    Change-Id: I1e7975f29e225bae74ed0c2d447e541fa47bd954
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114146
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 7783e65756e1..c4f5ddf17980 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -152,8 +152,8 @@ lcl_ConvertTOUNameToUserName(OUString& rTmp)
         USER_AND_SUFFIXLEN == rTmp.getLength())
     {
         //make sure that in non-English versions the " (user)" suffix is removed
-        if (rTmp.match(cUserDefined) &&
-            rTmp.matchAsciiL(cUserSuffix, sizeof(cUserSuffix), USER_LEN))
+        if (rTmp.startsWith(cUserDefined) &&
+            rTmp.match(cUserSuffix, USER_LEN))
         {
             rTmp = cUserDefined;
         }


More information about the Libreoffice-commits mailing list