sw/source/core/doc/SwStyleNameMapper.cxx |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

New commits:
commit 5d713d110e37451d87f620793304f0f1c9b8dfcc
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Dec 13 09:56:49 2022 +0000
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Dec 14 14:09:10 2022 +0000

    Simplify lcl_SuffixIsUser
    
    Change-Id: Ia8fbfd509541586ac7ae1f4a79230eda34f27956
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144027
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx 
b/sw/source/core/doc/SwStyleNameMapper.cxx
index fcb39150ed23..9861e4cc4f11 100644
--- a/sw/source/core/doc/SwStyleNameMapper.cxx
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -62,19 +62,9 @@ lcl_GetSpecialExtraName(const OUString& rExtraName, const 
bool bIsUIName )
 
 bool lcl_SuffixIsUser(const OUString & rString)
 {
-    const sal_Unicode *pChar = rString.getStr();
-    sal_Int32 nLen = rString.getLength();
-    bool bRet = false;
-    if( nLen > 8 &&
-        pChar[nLen-7] == ' ' &&
-        pChar[nLen-6] == '(' &&
-        pChar[nLen-5] == 'u' &&
-        pChar[nLen-4] == 's' &&
-        pChar[nLen-3] == 'e' &&
-        pChar[nLen-2] == 'r' &&
-        pChar[nLen-1] == ')' )
-        bRet = true;
-    return bRet;
+    // Interesting, why the rest must be longer than 1 character? It is so
+    // since commit 4fbc9dd48b7cebb304010e7337b1bbc3936c7923 (2001-08-16)
+    return rString.getLength() > 8 && rString.endsWith(" (user)");
 }
 
 void lcl_CheckSuffixAndDelete(OUString & rString)

Reply via email to