sc/source/core/tool/compiler.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 9f3bce835e81dbdf07da9850a5157f4403819417
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Tue Jun 21 23:06:45 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Wed Jun 22 01:19:04 2022 +0200

    Related: tdf#142293 Consider bAsciiUpper for matching CharClass to lowercase
    
    ... as also that may had lead to the locale's uppercase.
    
    Change-Id: I5c75b4e52260539f5b66c0d2195b2137c9b1b8ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136265
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 537d69b6f1c32e5b938d9ef24c4154a08d565363)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136237

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 301d90ed3b7a..2945062f1b37 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4464,6 +4464,7 @@ bool ScCompiler::NextNewToken( bool bInArray )
     // ParseReference().
 
     OUString aUpper;
+    bool bAsciiUpper = false;
 
 Label_Rewind:
 
@@ -4483,7 +4484,7 @@ Label_Rewind:
 
         mbRewind = false;
         aUpper.clear();
-        bool bAsciiUpper = false;
+        bAsciiUpper = false;
 
         if (bAsciiNonAlnum)
         {
@@ -4554,6 +4555,8 @@ Label_Rewind:
             // more likely in that localized language than in the formula
             // language. This in corner cases needs to continue to work for
             // existing documents and environments.
+            // Do not change bAsciiUpper from here on for the lowercase() call
+            // below in the ocBad case to use the correct CharClass.
             aUpper = ScGlobal::getCharClass().uppercase( aOrg );
         }
 
@@ -4618,7 +4621,7 @@ Label_Rewind:
     // would prematurely end compilation. Simple unknown names are handled by
     // the interpreter.
     // Use the same CharClass that was used for uppercase.
-    aUpper = (mbCharClassesDiffer ? ScGlobal::getCharClass() : 
*pCharClass).lowercase( aUpper );
+    aUpper = ((bAsciiUpper || mbCharClassesDiffer) ? ScGlobal::getCharClass() 
: *pCharClass).lowercase( aUpper );
     svl::SharedString aSS = rDoc.GetSharedStringPool().intern(aUpper);
     maRawToken.SetString(aSS.getData(), aSS.getDataIgnoreCase());
     maRawToken.NewOpCode( ocBad );

Reply via email to