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

Frédéric Wang fred.wang at free.fr
Fri Jun 28 02:50:56 PDT 2013


 starmath/source/parse.cxx |   52 ++++++++++++++++++++--------------------------
 1 file changed, 23 insertions(+), 29 deletions(-)

New commits:
commit 2ca754cba469533b1ed160b2fadbbe035cf1db34
Author: Frédéric Wang <fred.wang at free.fr>
Date:   Sun Jun 23 13:44:35 2013 +0200

    Remove unused String::Copy in Math (try to fix fdo#36634)
    
    Change-Id: I4a5618a7ef17a74edd036c34d748715d186f6528
    Reviewed-on: https://gerrit.libreoffice.org/4457
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 9ae5dff..5a0098b 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -448,8 +448,7 @@ void SmParser::NextToken()
         }
         else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
         {
-            String aName( m_aBufferString.Copy( nRealStart, 2 ));
-            if ( aName.EqualsAscii( "%%" ))
+            if (m_aBufferString.EqualsAscii("%%", nRealStart, 2))
             {
                 //SkipComment
                 m_nBufferIndex = nRealStart + 2;
@@ -549,17 +548,15 @@ void SmParser::NextToken()
     else if (aRes.TokenType & KParseType::BOOLEAN)
     {
         sal_Int32   &rnEndPos = aRes.EndPos;
-        String  aName( m_aBufferString.Copy( nRealStart,
-                        sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) ));
-        if (2 >= aName.Len())
+        if (rnEndPos - nRealStart <= 2)
         {
-            sal_Unicode ch = aName.GetChar( 0 );
+            sal_Unicode ch = m_aBufferString.GetChar(nRealStart);
             switch (ch)
             {
                 case '<':
                     {
-                        if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( "<<" ))
+                        if (m_aBufferString.
+                                EqualsAscii("<<", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TLL;
                             m_aCurToken.cMathChar = MS_LL;
@@ -569,8 +566,8 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( "<=" ))
+                        else if (m_aBufferString.
+                                     EqualsAscii("<=", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TLE;
                             m_aCurToken.cMathChar = MS_LE;
@@ -580,8 +577,8 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( "<>" ))
+                        else if (m_aBufferString.
+                                     EqualsAscii("<>", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TNEQ;
                             m_aCurToken.cMathChar = MS_NEQ;
@@ -591,8 +588,8 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.Copy( nRealStart, 3 ).
-                                EqualsAscii( "<?>" ))
+                        else if (m_aBufferString.
+                                     EqualsAscii("<?>", nRealStart, 3))
                         {
                             m_aCurToken.eType    = TPLACE;
                             m_aCurToken.cMathChar = MS_PLACE;
@@ -614,8 +611,8 @@ void SmParser::NextToken()
                     break;
                 case '>':
                     {
-                        if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( ">=" ))
+                        if (m_aBufferString.
+                                EqualsAscii(">=", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TGE;
                             m_aCurToken.cMathChar = MS_GE;
@@ -625,8 +622,8 @@ void SmParser::NextToken()
 
                             rnEndPos = nRealStart + 2;
                         }
-                        else if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( ">>" ))
+                        else if (m_aBufferString.
+                                     EqualsAscii(">>", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TGG;
                             m_aCurToken.cMathChar = MS_GG;
@@ -654,12 +651,9 @@ void SmParser::NextToken()
     else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
     {
         sal_Int32   &rnEndPos = aRes.EndPos;
-        String  aName( m_aBufferString.Copy( nRealStart,
-                            sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) ) );
-
-        if (1 == aName.Len())
+        if (rnEndPos - nRealStart == 1)
         {
-            sal_Unicode ch = aName.GetChar( 0 );
+            sal_Unicode ch = m_aBufferString.GetChar(nRealStart);
             switch (ch)
             {
                 case '%':
@@ -795,8 +789,8 @@ void SmParser::NextToken()
                     break;
                 case '#':
                     {
-                        if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( "##" ))
+                        if (m_aBufferString.
+                                EqualsAscii("##", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TDPOUND;
                             m_aCurToken.cMathChar = '\0';
@@ -854,8 +848,8 @@ void SmParser::NextToken()
                     break;
                 case '+':
                     {
-                        if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( "+-" ))
+                        if (m_aBufferString.
+                                EqualsAscii("+-", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TPLUSMINUS;
                             m_aCurToken.cMathChar = MS_PLUSMINUS;
@@ -877,8 +871,8 @@ void SmParser::NextToken()
                     break;
                 case '-':
                     {
-                        if (m_aBufferString.Copy( nRealStart, 2 ).
-                                EqualsAscii( "-+" ))
+                        if (m_aBufferString.
+                                EqualsAscii("-+", nRealStart, 2))
                         {
                             m_aCurToken.eType    = TMINUSPLUS;
                             m_aCurToken.cMathChar = MS_MINUSPLUS;


More information about the Libreoffice-commits mailing list