[Libreoffice-commits] core.git: starmath/inc starmath/qa starmath/source

Thomas Arnhold thomas at arnhold.org
Thu Sep 5 01:13:25 PDT 2013


 starmath/inc/node.hxx                 |    2 
 starmath/inc/parse.hxx                |   30 ++++----
 starmath/qa/cppunit/test_starmath.cxx |    2 
 starmath/source/accessibility.cxx     |    4 -
 starmath/source/edit.cxx              |    2 
 starmath/source/node.cxx              |    2 
 starmath/source/parse.cxx             |  121 +++++++++++++++-------------------
 starmath/source/smmod.cxx             |   16 ++--
 8 files changed, 84 insertions(+), 95 deletions(-)

New commits:
commit 6f135b0aa231a2543d73f94e39cb472e12ea47d5
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Wed Sep 4 17:09:22 2013 +0200

    String to OUString
    
    And removed nearly all xub_StrLen in starmath.
    
    Some sal_uInt16 which were xub_StrLen before
    9a0d753b84aed53083bed3ed460308b771f432a8 are also converted to sal_Int32
    where applicable.
    
    Change-Id: I31d7794f4c7aa840545edff41a102b76bb39e042
    Reviewed-on: https://gerrit.libreoffice.org/5817
    Reviewed-by: Andrzej J.R. Hunt <andrzej at ahunt.org>
    Tested-by: Andrzej J.R. Hunt <andrzej at ahunt.org>

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index b449666..38243dd 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -159,7 +159,7 @@ public:
 
     virtual void    GetAccessibleText( OUStringBuffer &rText ) const;
     sal_Int32       GetAccessibleIndex() const { return nAccIndex; }
-    const SmNode *  FindNodeWithAccessibleIndex(xub_StrLen nAccIndex) const;
+    const SmNode *  FindNodeWithAccessibleIndex(sal_Int32 nAccIndex) const;
 
     sal_uInt16  GetRow() const    { return (sal_uInt16)aNodeToken.nRow; }
     sal_uInt16  GetColumn() const { return (sal_uInt16)aNodeToken.nCol; }
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index e5cc5a4..d7eefcf 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -118,8 +118,8 @@ struct SmToken
     sal_uInt16      nLevel;
 
     // token position
-    sal_uInt16      nRow;
-    xub_StrLen      nCol;
+    sal_Int32      nRow;
+    sal_Int32      nCol;
 
     SmToken();
     SmToken(SmTokenType eTokenType,
@@ -150,7 +150,7 @@ struct SmErrorDesc
 {
     SmParseError  Type;
     SmNode       *pNode;
-    String        Text;
+    OUString      Text;
 };
 
 
@@ -180,15 +180,15 @@ struct SmTokenTableEntry
 
 class SmParser
 {
-    String          m_aBufferString;
+    OUString        m_aBufferString;
     SmToken         m_aCurToken;
     SmNodeStack     m_aNodeStack;
     SmErrDescList   m_aErrDescList;
     int             m_nCurError;
     LanguageType    m_nLang;
-    xub_StrLen      m_nBufferIndex,
+    sal_Int32       m_nBufferIndex,
                     m_nTokenIndex;
-    sal_uInt16          m_Row,
+    sal_Int32       m_Row,
                     m_nColOff;
     SmConvert       m_eConversion;
     bool            bImportSymNames,
@@ -206,12 +206,12 @@ class SmParser
 
 protected:
 #if OSL_DEBUG_LEVEL > 1
-    bool            IsDelimiter( const String &rTxt, xub_StrLen nPos );
+    bool            IsDelimiter( const OUString &rTxt, sal_Int32 nPos );
 #endif
     void            NextToken();
-    xub_StrLen      GetTokenIndex() const   { return m_nTokenIndex; }
-    void            Insert(const String &rText, sal_uInt16 nPos);
-    void            Replace( sal_uInt16 nPos, sal_uInt16 nLen, const String &rText );
+    sal_Int32       GetTokenIndex() const   { return m_nTokenIndex; }
+    void            Insert(const OUString &rText, sal_Int32 nPos);
+    void            Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText );
 
     inline bool     TokenInGroup( sal_uLong nGroup );
 
@@ -253,17 +253,17 @@ protected:
     void    Error(SmParseError Error);
 
     void    ClearUsedSymbols()                              { m_aUsedSymbols.clear(); }
-    void    AddToUsedSymbols( const String &rSymbolName )   { m_aUsedSymbols.insert( rSymbolName ); }
+    void    AddToUsedSymbols( const OUString &rSymbolName ) { m_aUsedSymbols.insert( rSymbolName ); }
 
 public:
                  SmParser();
 
     /** Parse rBuffer to formula tree */
-    SmNode      *Parse(const String &rBuffer);
+    SmNode      *Parse(const OUString &rBuffer);
     /** Parse rBuffer to formula subtree that constitutes an expression */
     SmNode      *ParseExpression(const OUString &rBuffer);
 
-    const String & GetText() const { return m_aBufferString; };
+    const OUString & GetText() const { return m_aBufferString; };
 
     SmConvert   GetConversion() const              { return m_eConversion; }
     void        SetConversion(SmConvert eConv)     { m_eConversion = eConv; }
@@ -277,8 +277,8 @@ public:
     const SmErrorDesc*  NextError();
     const SmErrorDesc*  PrevError();
     const SmErrorDesc*  GetError(size_t i = size_t(-1) );
-    static const SmTokenTableEntry* GetTokenTableEntry( const String &rName );
-    bool    IsUsedSymbol( const String &rSymbolName ) const { return m_aUsedSymbols.find( rSymbolName ) != m_aUsedSymbols.end(); }
+    static const SmTokenTableEntry* GetTokenTableEntry( const OUString &rName );
+    bool    IsUsedSymbol( const OUString &rSymbolName ) const { return m_aUsedSymbols.find( rSymbolName ) != m_aUsedSymbols.end(); }
     std::set< OUString >   GetUsedSymbols() const      { return m_aUsedSymbols; }
 };
 
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 5668618..8ae2f6c 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -142,7 +142,7 @@ void Test::editMarker()
 
 void Test::editFailure()
 {
-    m_xDocShRef->SetText(String("color a b over {a/}"));
+    m_xDocShRef->SetText("color a b over {a/}");
 
     const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
 
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index ca8b35d..98a2ece 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -504,7 +504,7 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
             --nIndex;
 
         const SmNode *pTree = pDoc->GetFormulaTree();
-        const SmNode *pNode = pTree->FindNodeWithAccessibleIndex( (xub_StrLen) nIndex );
+        const SmNode *pNode = pTree->FindNodeWithAccessibleIndex( nIndex );
         //! pNode may be 0 if the index belongs to a char that was inserted
         //! only for the accessible text!
         if (pNode)
@@ -1450,7 +1450,7 @@ void SmTextForwarder::AppendParagraph()
 
 sal_uInt16 SmTextForwarder::AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet )
 {
-    xub_StrLen nRes = 0;
+    sal_uInt16 nRes = 0;
     EditEngine *pEditEngine = rEditAcc.GetEditEngine();
     if (pEditEngine && nPara < pEditEngine->GetParagraphCount())
     {
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index fa32b8f..a1a541f 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -823,7 +823,7 @@ void SmEditWindow::MarkError(const Point &rPos)
     OSL_ENSURE( pEditView, "EditView missing" );
     if (pEditView)
     {
-        const xub_StrLen    nCol = sal::static_int_cast< xub_StrLen >(rPos.X());
+        const sal_uInt16        nCol = sal::static_int_cast< sal_uInt16 >(rPos.X());
         const sal_uInt16        nRow = sal::static_int_cast< sal_uInt16 >(rPos.Y() - 1);
 
         pEditView->SetSelection(ESelection(nRow, nCol - 1, nRow, nCol));
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 87ad75d..c540c68 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -519,7 +519,7 @@ void SmNode::GetAccessibleText( OUStringBuffer &/*rText*/ ) const
     OSL_FAIL( "SmNode: GetAccessibleText not overloaded" );
 }
 
-const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const
+const SmNode * SmNode::FindNodeWithAccessibleIndex(sal_Int32 nAccIdx) const
 {
     const SmNode *pResult = 0;
 
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index bbc6377..8baa1ec 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -302,14 +302,14 @@ static const SmTokenTableEntry aTokenTable[] =
     { "", TEND, '\0', 0, 0}
 };
 
-const SmTokenTableEntry * SmParser::GetTokenTableEntry( const String &rName )
+const SmTokenTableEntry * SmParser::GetTokenTableEntry( const OUString &rName )
 {
     const SmTokenTableEntry * pRes = 0;
-    if (rName.Len())
+    if (!rName.isEmpty())
     {
         for (size_t i = 0; i < SAL_N_ELEMENTS(aTokenTable); ++i)
         {
-            if (rName.EqualsIgnoreCaseAscii( aTokenTable[i].pIdent ))
+            if (rName.equalsIgnoreAsciiCase( OUString::createFromAscii(aTokenTable[i].pIdent) ))
             {
                 pRes = &aTokenTable[i];
                 break;
@@ -325,12 +325,12 @@ const SmTokenTableEntry * SmParser::GetTokenTableEntry( const String &rName )
 
 #if OSL_DEBUG_LEVEL > 1
 
-bool SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos )
+bool SmParser::IsDelimiter( const OUString &rTxt, sal_Int32 nPos )
     // returns 'true' iff cChar is '\0' or a delimeter
 {
-    OSL_ENSURE( nPos <= rTxt.Len(), "index out of range" );
+    OSL_ENSURE( nPos <= rTxt.getLength(), "index out of range" );
 
-    sal_Unicode cChar = rTxt.GetChar( nPos );
+    sal_Unicode cChar = rTxt[nPos];
     if(!cChar)
         return true;
 
@@ -351,22 +351,22 @@ bool SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos )
 
 #endif
 
-void SmParser::Insert(const String &rText, sal_uInt16 nPos)
+void SmParser::Insert(const OUString &rText, sal_Int32 nPos)
 {
-    m_aBufferString.Insert(rText, nPos);
+    m_aBufferString = m_aBufferString.replaceAt(nPos, 0, rText);
 
-    xub_StrLen  nLen = rText.Len();
+    sal_Int32 nLen = rText.getLength();
     m_nBufferIndex = m_nBufferIndex + nLen;
     m_nTokenIndex  = m_nTokenIndex + nLen;
 }
 
 
-void SmParser::Replace( sal_uInt16 nPos, sal_uInt16 nLen, const String &rText )
+void SmParser::Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText )
 {
-    OSL_ENSURE( nPos + nLen <= m_aBufferString.Len(), "argument mismatch" );
+    OSL_ENSURE( nPos + nLen <= m_aBufferString.getLength(), "argument mismatch" );
 
-    m_aBufferString.Replace( nPos, nLen, rText );
-    sal_Int16  nChg = rText.Len() - nLen;
+    m_aBufferString = m_aBufferString.replaceAt( nPos, nLen, rText );
+    sal_Int32 nChg = rText.getLength() - nLen;
     m_nBufferIndex = m_nBufferIndex + nChg;
     m_nTokenIndex = m_nTokenIndex + nChg;
 }
@@ -393,11 +393,11 @@ const sal_Int32 coNumContFlags =
 
 void SmParser::NextToken()
 {
-    static const String aEmptyStr;
+    static const OUString aEmptyStr;
 
-    xub_StrLen  nBufLen = m_aBufferString.Len();
+    sal_Int32   nBufLen = m_aBufferString.getLength();
     ParseResult aRes;
-    xub_StrLen  nRealStart;
+    sal_Int32   nRealStart;
     bool        bCont;
     CharClass   aCC(SM_MOD()->GetSysLocale().GetLanguageTag());
     do
@@ -426,13 +426,13 @@ void SmParser::NextToken()
                                      coContFlags, aEmptyStr);
         }
 
-        nRealStart = m_nBufferIndex + sal::static_int_cast< xub_StrLen >(aRes.LeadingWhiteSpace);
+        nRealStart = m_nBufferIndex + aRes.LeadingWhiteSpace;
         m_nBufferIndex = nRealStart;
 
         bCont = false;
         if ( aRes.TokenType == 0  &&
                 nRealStart < nBufLen &&
-                '\n' == m_aBufferString.GetChar( nRealStart ) )
+                '\n' == m_aBufferString[ nRealStart ] )
         {
             // keep data needed for tokens row and col entry up to date
             ++m_Row;
@@ -441,12 +441,12 @@ void SmParser::NextToken()
         }
         else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
         {
-            if (m_aBufferString.EqualsAscii("%%", nRealStart, 2))
+            if (m_aBufferString.copy(nRealStart, 2) == "%%")
             {
                 //SkipComment
                 m_nBufferIndex = nRealStart + 2;
                 while (m_nBufferIndex < nBufLen  &&
-                    '\n' != m_aBufferString.GetChar( m_nBufferIndex ))
+                    '\n' != m_aBufferString[ m_nBufferIndex ])
                     ++m_nBufferIndex;
                 bCont = true;
             }
@@ -477,10 +477,10 @@ void SmParser::NextToken()
         m_aCurToken.cMathChar  = '\0';
         m_aCurToken.nGroup     = 0;
         m_aCurToken.nLevel     = 5;
-        m_aCurToken.aText      = m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) );
+        m_aCurToken.aText      = m_aBufferString.copy( nRealStart, n );
 
 #if OSL_DEBUG_LEVEL > 1
-        if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
+        if (!IsDelimiter( m_aBufferString, aRes.EndPos ))
         {
             OSL_FAIL( "identifier really finished? (compatibility!)" );
         }
@@ -500,7 +500,7 @@ void SmParser::NextToken()
     {
         sal_Int32 n = aRes.EndPos - nRealStart;
         OSL_ENSURE( n >= 0, "length < 0" );
-        String aName( m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) );
+        OUString aName( m_aBufferString.copy( nRealStart, n ) );
         const SmTokenTableEntry *pEntry = GetTokenTableEntry( aName );
 
         if (pEntry)
@@ -520,14 +520,14 @@ void SmParser::NextToken()
             m_aCurToken.aText      = aName;
 
 #if OSL_DEBUG_LEVEL > 1
-            if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
+            if (!IsDelimiter( m_aBufferString, aRes.EndPos ))
             {
                 OSL_FAIL( "identifier really finished? (compatibility!)" );
             }
 #endif
         }
     }
-    else if (aRes.TokenType == 0  &&  '_' == m_aBufferString.GetChar( nRealStart ))
+    else if (aRes.TokenType == 0  &&  '_' == m_aBufferString[ nRealStart ])
     {
         m_aCurToken.eType    = TRSUB;
         m_aCurToken.cMathChar = '\0';
@@ -542,13 +542,12 @@ void SmParser::NextToken()
         sal_Int32   &rnEndPos = aRes.EndPos;
         if (rnEndPos - nRealStart <= 2)
         {
-            sal_Unicode ch = m_aBufferString.GetChar(nRealStart);
+            sal_Unicode ch = m_aBufferString[ nRealStart ];
             switch (ch)
             {
                 case '<':
                     {
-                        if (m_aBufferString.
-                                EqualsAscii("<<", nRealStart, 2))
+                        if (m_aBufferString.copy(nRealStart, 2) == "<<")
                         {
                             m_aCurToken.eType    = TLL;
                             m_aCurToken.cMathChar = MS_LL;
@@ -558,8 +557,7 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.
-                                     EqualsAscii("<=", nRealStart, 2))
+                        else if (m_aBufferString.copy(nRealStart, 2) == "<=")
                         {
                             m_aCurToken.eType    = TLE;
                             m_aCurToken.cMathChar = MS_LE;
@@ -569,8 +567,7 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.
-                                     EqualsAscii("<>", nRealStart, 2))
+                        else if (m_aBufferString.copy(nRealStart, 2) == "<>")
                         {
                             m_aCurToken.eType    = TNEQ;
                             m_aCurToken.cMathChar = MS_NEQ;
@@ -580,8 +577,7 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.
-                                     EqualsAscii("<?>", nRealStart, 3))
+                        else if (m_aBufferString.copy(nRealStart, 3) == "<?>")
                         {
                             m_aCurToken.eType    = TPLACE;
                             m_aCurToken.cMathChar = MS_PLACE;
@@ -603,8 +599,7 @@ void SmParser::NextToken()
                     break;
                 case '>':
                     {
-                        if (m_aBufferString.
-                                EqualsAscii(">=", nRealStart, 2))
+                        if (m_aBufferString.copy(nRealStart, 2) == ">=")
                         {
                             m_aCurToken.eType    = TGE;
                             m_aCurToken.cMathChar = MS_GE;
@@ -614,8 +609,7 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.
-                                     EqualsAscii(">>", nRealStart, 2))
+                        else if (m_aBufferString.copy(nRealStart, 2) == ">>")
                         {
                             m_aCurToken.eType    = TGG;
                             m_aCurToken.cMathChar = MS_GG;
@@ -645,7 +639,7 @@ void SmParser::NextToken()
         sal_Int32   &rnEndPos = aRes.EndPos;
         if (rnEndPos - nRealStart == 1)
         {
-            sal_Unicode ch = m_aBufferString.GetChar(nRealStart);
+            sal_Unicode ch = m_aBufferString[ nRealStart ];
             switch (ch)
             {
                 case '%':
@@ -653,7 +647,7 @@ void SmParser::NextToken()
                         //! modifies aRes.EndPos
 
                         OSL_ENSURE( rnEndPos >= nBufLen  ||
-                                    '%' != m_aBufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ),
+                                    '%' != m_aBufferString[ rnEndPos ],
                                 "unexpected comment start" );
 
                         // get identifier of user-defined character
@@ -664,8 +658,7 @@ void SmParser::NextToken()
                                 coContFlags,
                                 aEmptyStr );
 
-                        xub_StrLen nTmpStart = sal::static_int_cast< xub_StrLen >(rnEndPos +
-                                                    aTmpRes.LeadingWhiteSpace);
+                        sal_Int32 nTmpStart = rnEndPos + aTmpRes.LeadingWhiteSpace;
 
                         // default setting for the case that no identifier
                         // i.e. a valid symbol-name is following the '%'
@@ -674,16 +667,16 @@ void SmParser::NextToken()
                         m_aCurToken.cMathChar  = '\0';
                         m_aCurToken.nGroup     = 0;
                         m_aCurToken.nLevel     = 5;
-                        m_aCurToken.aText      = String();
-                        m_aCurToken.nRow       = sal::static_int_cast< xub_StrLen >(m_Row);
+                        m_aCurToken.aText      = OUString();
+                        m_aCurToken.nRow       = m_Row;
                         m_aCurToken.nCol       = nTmpStart - m_nColOff;
 
                         if (aTmpRes.TokenType & KParseType::IDENTNAME)
                         {
 
-                            xub_StrLen n = sal::static_int_cast< xub_StrLen >(aTmpRes.EndPos - nTmpStart);
+                            sal_Int32 n = aTmpRes.EndPos - nTmpStart;
                             m_aCurToken.eType      = TSPECIAL;
-                            m_aCurToken.aText      = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 );
+                            m_aCurToken.aText      = m_aBufferString.copy( nTmpStart-1, n+1 );
 
                             OSL_ENSURE( aTmpRes.EndPos > rnEndPos,
                                     "empty identifier" );
@@ -781,8 +774,7 @@ void SmParser::NextToken()
                     break;
                 case '#':
                     {
-                        if (m_aBufferString.
-                                EqualsAscii("##", nRealStart, 2))
+                        if (m_aBufferString.copy(nRealStart, 2) == "##")
                         {
                             m_aCurToken.eType    = TDPOUND;
                             m_aCurToken.cMathChar = '\0';
@@ -840,8 +832,7 @@ void SmParser::NextToken()
                     break;
                 case '+':
                     {
-                        if (m_aBufferString.
-                                EqualsAscii("+-", nRealStart, 2))
+                        if (m_aBufferString.copy(nRealStart, 2) == "+-")
                         {
                             m_aCurToken.eType    = TPLUSMINUS;
                             m_aCurToken.cMathChar = MS_PLUSMINUS;
@@ -863,8 +854,7 @@ void SmParser::NextToken()
                     break;
                 case '-':
                     {
-                        if (m_aBufferString.
-                                EqualsAscii("-+", nRealStart, 2))
+                        if (m_aBufferString.copy(nRealStart, 2) == "-+")
                         {
                             m_aCurToken.eType    = TMINUSPLUS;
                             m_aCurToken.cMathChar = MS_MINUSPLUS;
@@ -894,16 +884,15 @@ void SmParser::NextToken()
                         m_aCurToken.nGroup       = 0;
                         m_aCurToken.nLevel    = 5;
 
-                        xub_StrLen nTxtStart = m_nBufferIndex;
+                        sal_Int32 nTxtStart = m_nBufferIndex;
                         sal_Unicode cChar;
                         do
                         {
-                            cChar = m_aBufferString.GetChar( ++m_nBufferIndex );
+                            cChar = m_aBufferString[ ++m_nBufferIndex ];
                         }
                         while ( cChar == '.' || rtl::isAsciiDigit( cChar ) );
 
-                        m_aCurToken.aText = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTxtStart),
-                                                            sal::static_int_cast< xub_StrLen >(m_nBufferIndex - nTxtStart) );
+                        m_aCurToken.aText = m_aBufferString.copy( nTxtStart, m_nBufferIndex - nTxtStart );
                         aRes.EndPos = m_nBufferIndex;
                     }
                     break;
@@ -939,13 +928,13 @@ void SmParser::NextToken()
         m_aCurToken.cMathChar  = '\0';
         m_aCurToken.nGroup     = 0;
         m_aCurToken.nLevel     = 5;
-        m_aCurToken.aText      = m_aBufferString.Copy( nRealStart, 1 );
+        m_aCurToken.aText      = m_aBufferString.copy( nRealStart, 1 );
 
         aRes.EndPos = nRealStart + 1;
     }
 
     if (TEND != m_aCurToken.eType)
-        m_nBufferIndex = sal::static_int_cast< xub_StrLen >(aRes.EndPos);
+        m_nBufferIndex = aRes.EndPos;
 }
 
 
@@ -995,7 +984,7 @@ void SmParser::Align()
         if (CONVERT_40_TO_50 == GetConversion())
             // encapsulate expression to be aligned in group braces
             // (here group-open brace)
-        {   Insert(OUString('{'), GetTokenIndex());
+        {   Insert("{", GetTokenIndex());
             bNeedGroupClose = true;
 
             // get first valid align statement in sequence
@@ -1006,7 +995,7 @@ void SmParser::Align()
                 if (TokenInGroup(TGDISCARDED) || pSNode)
                 {
                     m_nBufferIndex = GetTokenIndex();
-                    m_aBufferString.Erase(m_nBufferIndex, m_aCurToken.aText.getLength());
+                    m_aBufferString = m_aBufferString.replaceAt(m_nBufferIndex, m_aCurToken.aText.getLength(), "");
                 }
                 else
                     pSNode = new SmAlignNode(m_aCurToken);
@@ -1033,7 +1022,7 @@ void SmParser::Align()
     Expression();
 
     if (bNeedGroupClose)
-        Insert(OUString('}'), GetTokenIndex());
+        Insert("}", GetTokenIndex());
 
     if (pSNode)
     {
@@ -1438,9 +1427,9 @@ void SmParser::Term(bool bGroupNumberIdent)
                 // work to distinguish from "x_2 n".
                 // See https://issues.apache.org/ooo/show_bug.cgi?id=11752 and
                 // https://www.libreoffice.org/bugzilla/show_bug.cgi?id=55853
-                xub_StrLen nBufLen = m_aBufferString.Len();
+                sal_Int32 nBufLen = m_aBufferString.getLength();
                 CharClass aCC(SM_MOD()->GetSysLocale().GetLanguageTag());
-                sal_uInt16 nTokens = 1;
+                sal_Int32 nTokens = 1;
 
                 // We need to be careful to call NextToken() only after having
                 // tested for a whitespace separator (otherwise it will be
@@ -1599,7 +1588,7 @@ void SmParser::Term(bool bGroupNumberIdent)
                 else    // encapsulate old 4.0 style parsing in braces
                 {
                     // insert opening brace
-                    Insert(OUString('{'), GetTokenIndex());
+                    Insert("{", GetTokenIndex());
 
                     //
                     // parse in 4.0 style
@@ -1616,7 +1605,7 @@ void SmParser::Term(bool bGroupNumberIdent)
                     }
 
                     // insert closing brace
-                    Insert(OUString('}'), GetTokenIndex());
+                    Insert("}", GetTokenIndex());
 
                     SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken());
                     pSNode->SetSubNodes(pFunc, lcl_popOrZero(m_aNodeStack));
@@ -2474,7 +2463,7 @@ SmParser::SmParser()
     m_nLang = Application::GetSettings().GetUILanguageTag().getLanguageType();
 }
 
-SmNode *SmParser::Parse(const String &rBuffer)
+SmNode *SmParser::Parse(const OUString &rBuffer)
 {
     ClearUsedSymbols();
 
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 35f5469..9f61773 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -86,8 +86,8 @@ const OUString SmLocalizedSymbolData::GetUiSymbolName( const OUString &rExportNa
     const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
     const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray();
     const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray();
-    sal_uInt16 nCount = sal::static_int_cast< xub_StrLen >(rExportNames.Count());
-    for (sal_uInt16 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
+    sal_uInt32 nCount = rExportNames.Count();
+    for (sal_uInt32 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
     {
         if (rExportNames.GetString(i).equals(rExportName))
         {
@@ -107,8 +107,8 @@ const OUString SmLocalizedSymbolData::GetExportSymbolName( const OUString &rUiNa
     const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
     const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray();
     const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray();
-    sal_uInt16 nCount = sal::static_int_cast< xub_StrLen >(rUiNames.Count());
-    for (sal_uInt16 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
+    sal_uInt32 nCount = rUiNames.Count();
+    for (sal_uInt32 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
     {
         if (rUiNames.GetString(i).equals(rUiName))
         {
@@ -128,8 +128,8 @@ const OUString SmLocalizedSymbolData::GetUiSymbolSetName( const OUString &rExpor
     const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
     const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray();
     const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray();
-    sal_uInt16 nCount = sal::static_int_cast< xub_StrLen >(rExportNames.Count());
-    for (sal_uInt16 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
+    sal_uInt32 nCount = rExportNames.Count();
+    for (sal_uInt32 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
     {
         if (rExportNames.GetString(i).equals(rExportName))
         {
@@ -149,8 +149,8 @@ const OUString SmLocalizedSymbolData::GetExportSymbolSetName( const OUString &rU
     const SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
     const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray();
     const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray();
-    sal_uInt16 nCount = sal::static_int_cast< xub_StrLen >(rUiNames.Count());
-    for (sal_uInt16 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
+    sal_uInt32 nCount = rUiNames.Count();
+    for (sal_uInt32 i = 0;  i < nCount  &&  aRes.isEmpty();  ++i)
     {
         if (rUiNames.GetString(i).equals(rUiName))
         {


More information about the Libreoffice-commits mailing list