[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/source

Matteo Casalin (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 21 01:16:33 UTC 2019


 sw/source/core/tox/tox.cxx |   33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

New commits:
commit c6ac6b53bcefadb5a62ab6a7e94e9e996f50ba71
Author:     Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sun Jan 14 19:12:30 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Sep 21 03:15:35 2019 +0200

    Return correct length for Authority token
    
    Regression from f4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9
    Take the chance to calculate token prefix just once.
    
    Change-Id: I19ce5cb037198cb918e79c760a92b285f9b725f1
    (cherry picked from commit 34b98af8e5a4e568d8316700bea1ce604d825ce8)
    Reviewed-on: https://gerrit.libreoffice.org/52621
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit c6e8460a5b47fa6fa971dde2a89e80662b6e97ae)
    Reviewed-on: https://gerrit.libreoffice.org/52626
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit df041d902eafb1e273eb360103252994bbd2cde2)
    Reviewed-on: https://gerrit.libreoffice.org/79276
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index ee0617d95114..5b56216b1215 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -661,30 +661,29 @@ static FormTokenType lcl_GetTokenType(const OUString & sToken,
 {
     static struct
     {
-        OUString sNm;
-        sal_uInt16 nOffset;
-        FormTokenType eToken;
+        OUString sTokenStart;
+        sal_Int16 nTokenLength;
+        FormTokenType eTokenType;
     } const aTokenArr[] = {
-        { SwForm::GetFormTab(),         1, TOKEN_TAB_STOP },
-        { SwForm::GetFormPageNums(),    1, TOKEN_PAGE_NUMS },
-        { SwForm::GetFormLinkStt(),     1, TOKEN_LINK_START },
-        { SwForm::GetFormLinkEnd(),     1, TOKEN_LINK_END },
-        { SwForm::GetFormEntryNum(),    1, TOKEN_ENTRY_NO },
-        { SwForm::GetFormEntryText(),    1, TOKEN_ENTRY_TEXT },
-        { SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO },
-        { SwForm::GetFormText(),        1, TOKEN_TEXT },
-        { SwForm::GetFormEntry(),       1, TOKEN_ENTRY },
-        { SwForm::GetFormAuth(),        3, TOKEN_AUTHORITY }
+        { SwForm::GetFormTab().copy(0, 2),         3, TOKEN_TAB_STOP },
+        { SwForm::GetFormPageNums().copy(0, 2),    3, TOKEN_PAGE_NUMS },
+        { SwForm::GetFormLinkStt().copy(0, 3),     4, TOKEN_LINK_START },
+        { SwForm::GetFormLinkEnd().copy(0, 3),     4, TOKEN_LINK_END },
+        { SwForm::GetFormEntryNum().copy(0, 3),    4, TOKEN_ENTRY_NO },
+        { SwForm::GetFormEntryText().copy(0, 3),   4, TOKEN_ENTRY_TEXT },
+        { SwForm::GetFormChapterMark().copy(0, 2), 3, TOKEN_CHAPTER_INFO },
+        { SwForm::GetFormText().copy(0, 2),        3, TOKEN_TEXT },
+        { SwForm::GetFormEntry().copy(0, 2),       3, TOKEN_ENTRY },
+        { SwForm::GetFormAuth().copy(0, 2),        5, TOKEN_AUTHORITY }
     };
 
     for(const auto & i : aTokenArr)
     {
-        const sal_Int32 nLen(i.sNm.getLength());
-        if( sToken.startsWith( i.sNm.copy(0, nLen - i.nOffset) ))
+        if( sToken.startsWith( i.sTokenStart ) )
         {
             if (pTokenLen)
-                *pTokenLen = nLen;
-            return i.eToken;
+                *pTokenLen = i.nTokenLength;
+            return i.eTokenType;
         }
     }
 


More information about the Libreoffice-commits mailing list