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

Takeshi Abe tabe at fixedpoint.jp
Thu Feb 19 03:31:00 PST 2015


 starmath/source/mathmlexport.cxx |    6 +++---
 starmath/source/mathmlimport.cxx |   32 ++++++++++++++++----------------
 starmath/source/node.cxx         |    8 ++++----
 starmath/source/parse.cxx        |    4 ++--
 4 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit fe3937a60368006a6e6f03b14ae43218139f0a90
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Feb 18 17:21:39 2015 +0900

    starmath: prefer exact types such as size_t and sal_uInt16 to sal_uLong
    
    Change-Id: Idb8e8ab8f73248021b9aa13efa04e77d9e331475
    Reviewed-on: https://gerrit.libreoffice.org/14530
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index b0cde9a..45bdcfc 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -750,7 +750,7 @@ void SmXMLExport::ExportExpression(const SmNode *pNode, int nLevel,
                                    bool bNoMrowContainer /*=false*/)
 {
     SvXMLElementExport *pRow=0;
-    sal_uLong  nSize = pNode->GetNumSubNodes();
+    auto nSize = pNode->GetNumSubNodes();
 
     // #i115443: nodes of type expression always need to be grouped with mrow statement
     if (!bNoMrowContainer &&
@@ -1527,10 +1527,10 @@ void SmXMLExport::ExportMatrix(const SmNode *pNode, int nLevel)
     SvXMLElementExport aTable(*this, XML_NAMESPACE_MATH, XML_MTABLE, true, true);
     const SmMatrixNode *pMatrix = static_cast<const SmMatrixNode *>(pNode);
     sal_uInt16 i=0;
-    for (sal_uLong y = 0; y < pMatrix->GetNumRows(); y++)
+    for (sal_uInt16 y = 0; y < pMatrix->GetNumRows(); y++)
     {
         SvXMLElementExport aRow(*this, XML_NAMESPACE_MATH, XML_MTR, true, true);
-        for (sal_uLong x = 0; x < pMatrix->GetNumCols(); x++)
+        for (sal_uInt16 x = 0; x < pMatrix->GetNumCols(); x++)
             if (const SmNode *pTemp = pNode->GetSubNode(i++))
             {
                 if (pTemp->GetType() == NALIGN &&
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 45510c8..488797e 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -782,7 +782,7 @@ public:
 class SmXMLRowContext_Impl : public SmXMLDocContext_Impl
 {
 protected:
-    sal_uLong nElementCount;
+    size_t nElementCount;
 
 public:
     SmXMLRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
@@ -1030,7 +1030,7 @@ void SmXMLFencedContext_Impl::EndElement()
     aToken.aText = ",";
     aToken.eType = TIDENT;
 
-    sal_uLong i = rNodeStack.size() - nElementCount;
+    auto i = rNodeStack.size() - nElementCount;
     if (rNodeStack.size() - nElementCount > 1)
         i += rNodeStack.size() - 1 - nElementCount;
     aRelationArray.resize(i);
@@ -1428,7 +1428,7 @@ void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup
     // initialize subnodes array
     SmNodeArray  aSubNodes;
     aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
-    for (sal_uLong i = 1;  i < aSubNodes.size();  i++)
+    for (size_t i = 1;  i < aSubNodes.size();  i++)
         aSubNodes[i] = NULL;
 
     aSubNodes[eSubSup+1] = popOrZero(rNodeStack);
@@ -1488,7 +1488,7 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
     // initialize subnodes array
     SmNodeArray  aSubNodes;
     aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
-    for (sal_uLong i = 1;  i < aSubNodes.size();  i++)
+    for (size_t i = 1;  i < aSubNodes.size();  i++)
         aSubNodes[i] = NULL;
 
     aSubNodes[aSup+1] = popOrZero(rNodeStack);
@@ -2146,9 +2146,9 @@ void SmXMLDocContext_Impl::EndElement()
     rNodeStack.push_front(pSNode);
 
     SmNodeArray  LineArray;
-    sal_uLong n = rNodeStack.size();
+    auto n = rNodeStack.size();
     LineArray.resize(n);
-    for (sal_uLong j = 0; j < n; j++)
+    for (size_t j = 0; j < n; j++)
     {
         auto pNode = rNodeStack.pop_front();
         LineArray[n - (j + 1)] = pNode.release();
@@ -2224,10 +2224,10 @@ void SmXMLRowContext_Impl::EndElement()
 
     if (rNodeStack.size() > nElementCount)
     {
-        sal_uLong nSize = rNodeStack.size() - nElementCount;
+        auto nSize = rNodeStack.size() - nElementCount;
 
         aRelationArray.resize(nSize);
-        for (sal_uLong j=nSize;j > 0;j--)
+        for (auto j=nSize;j > 0;j--)
         {
             auto pNode = rNodeStack.pop_front();
             aRelationArray[j-1] = pNode.release();
@@ -2421,7 +2421,7 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
     if (rNodeStack.size() <= nElementCount)
         return;
 
-    sal_uLong nCount = rNodeStack.size() - nElementCount - 1;
+    auto nCount = rNodeStack.size() - nElementCount - 1;
     if (nCount == 0)
         return;
 
@@ -2432,7 +2432,7 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
         aToken.eType = bIsPrescript ? TLSUB : TRSUB;
 
         SmNodeStack aReverseStack;
-        for (sal_uLong i = 0; i < nCount + 1; i++)
+        for (size_t i = 0; i < nCount + 1; i++)
         {
             auto pNode = rNodeStack.pop_front();
             aReverseStack.push_front(pNode.release());
@@ -2441,7 +2441,7 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
         SmSubSup eSub = bIsPrescript ? LSUB : RSUB;
         SmSubSup eSup = bIsPrescript ? LSUP : RSUP;
 
-        for (sal_uLong i = 0; i < nCount; i += 2)
+        for (size_t i = 0; i < nCount; i += 2)
         {
             SmSubSupNode *pNode = new SmSubSupNode(aToken);
 
@@ -2473,7 +2473,7 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
     else
     {
         // Ignore odd number of elements.
-        for (sal_uLong i = 0; i < nCount; i++)
+        for (size_t i = 0; i < nCount; i++)
         {
             rNodeStack.pop_front();
         }
@@ -2488,11 +2488,11 @@ void SmXMLTableContext_Impl::EndElement()
     SmNodeStack aReverseStack;
     aExpressionArray.resize(rNodeStack.size()-nElementCount);
 
-    sal_uLong nRows = rNodeStack.size()-nElementCount;
+    auto nRows = rNodeStack.size()-nElementCount;
     sal_uInt16 nCols = 0;
 
     SmStructureNode *pArray;
-    for (sal_uLong i=nRows;i > 0;i--)
+    for (auto i=nRows;i > 0;i--)
     {
         auto pNode = rNodeStack.pop_front();
         pArray = static_cast<SmStructureNode *>(pNode.release());
@@ -2519,7 +2519,7 @@ void SmXMLTableContext_Impl::EndElement()
         aReverseStack.push_front(pArray);
     }
     aExpressionArray.resize(nCols*nRows);
-    sal_uLong j=0;
+    size_t j=0;
     while ( !aReverseStack.empty() )
     {
         auto pNode = aReverseStack.pop_front();
@@ -2597,7 +2597,7 @@ void SmXMLActionContext_Impl::EndElement()
      first pushed one*/
 
     SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
-    for (sal_uLong i=rNodeStack.size()-nElementCount;i > 1;i--)
+    for (auto i=rNodeStack.size()-nElementCount;i > 1;i--)
     {
         rNodeStack.pop_front();
     }
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 5669ba1..0e95f9c 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -576,12 +576,12 @@ long SmNode::GetFormulaBaseline() const
 SmStructureNode::SmStructureNode( const SmStructureNode &rNode ) :
     SmNode( rNode.GetType(), rNode.GetToken() )
 {
-    sal_uLong i;
+    size_t i;
     for (i = 0;  i < aSubNodes.size();  i++)
         delete aSubNodes[i];
     aSubNodes.resize(0);
 
-    sal_uLong nSize = rNode.aSubNodes.size();
+    auto nSize = rNode.aSubNodes.size();
     aSubNodes.resize( nSize );
     for (i = 0;  i < nSize;  ++i)
     {
@@ -606,12 +606,12 @@ SmStructureNode & SmStructureNode::operator = ( const SmStructureNode &rNode )
 {
     SmNode::operator = ( rNode );
 
-    sal_uLong i;
+    size_t i;
     for (i = 0;  i < aSubNodes.size();  i++)
         delete aSubNodes[i];
     aSubNodes.resize(0);
 
-    sal_uLong nSize = rNode.aSubNodes.size();
+    auto nSize = rNode.aSubNodes.size();
     aSubNodes.resize( nSize );
     for (i = 0;  i < nSize;  ++i)
     {
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 31e4962..17a6a63 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -955,11 +955,11 @@ void SmParser::Table()
     if (m_aCurToken.eType != TEND)
         Error(PE_UNEXPECTED_CHAR);
 
-    sal_uLong n = m_aNodeStack.size();
+    auto n = m_aNodeStack.size();
 
     LineArray.resize(n);
 
-    for (sal_uLong i = 0; i < n; i++)
+    for (size_t i = 0; i < n; i++)
     {
         auto pNode = m_aNodeStack.pop_front();
         LineArray[n - (i + 1)] = pNode.release();


More information about the Libreoffice-commits mailing list