summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-22 10:13:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-24 12:02:22 +0100
commitab0b2b44f53652590eb290f6f4adf2ddde5a700d (patch)
tree94327c67f16893e00e802a46e77d760a695d18a0
parent617a2feff0978d06aa2759038715dfde90d369db (diff)
coverity#1426873 Unintended sign extension
and a bunch of others Change-Id: I110545b74bfc71b17e2e10edc95bc4bb5aa5651c Reviewed-on: https://gerrit.libreoffice.org/46957 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--starmath/source/node.cxx8
-rw-r--r--starmath/source/ooxmlexport.cxx4
-rw-r--r--starmath/source/rtfexport.cxx4
-rw-r--r--starmath/source/visitors.cxx20
4 files changed, 20 insertions, 16 deletions
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 4839248940de..f725f5225995 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2204,17 +2204,17 @@ sal_Unicode SmTextNode::ConvertSymbolToUnicode(sal_Unicode nIn)
void SmMatrixNode::CreateTextFromNode(OUString &rText)
{
rText += "matrix {";
- for (sal_uInt16 i = 0; i < mnNumRows; i++)
+ for (size_t i = 0; i < mnNumRows; ++i)
{
- for (sal_uInt16 j = 0; j < mnNumCols; j++)
+ for (size_t j = 0; j < mnNumCols; ++j)
{
SmNode *pNode = GetSubNode(i * mnNumCols + j);
if (pNode)
pNode->CreateTextFromNode(rText);
- if (j != mnNumCols-1)
+ if (j != mnNumCols - 1U)
rText += "# ";
}
- if (i != mnNumRows-1)
+ if (i != mnNumRows - 1U)
rText += "## ";
}
rText = comphelper::string::stripEnd(rText, ' ');
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index 7e731fb717ca..e718a4ed7ca5 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -437,10 +437,10 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n
void SmOoxmlExport::HandleMatrix( const SmMatrixNode* pNode, int nLevel )
{
m_pSerializer->startElementNS( XML_m, XML_m, FSEND );
- for( int row = 0; row < pNode->GetNumRows(); ++row )
+ for (size_t row = 0; row < pNode->GetNumRows(); ++row)
{
m_pSerializer->startElementNS( XML_m, XML_mr, FSEND );
- for( int col = 0; col < pNode->GetNumCols(); ++col )
+ for (size_t col = 0; col < pNode->GetNumCols(); ++col)
{
m_pSerializer->startElementNS( XML_m, XML_e, FSEND );
if( const SmNode* node = pNode->GetSubNode( row * pNode->GetNumCols() + col ))
diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx
index 50d32b393221..9835ffbf9f4a 100644
--- a/starmath/source/rtfexport.cxx
+++ b/starmath/source/rtfexport.cxx
@@ -386,10 +386,10 @@ void SmRtfExport::HandleSubSupScriptInternal(const SmSubSupNode* pNode, int nLev
void SmRtfExport::HandleMatrix(const SmMatrixNode* pNode, int nLevel)
{
m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MM " ");
- for (int row = 0; row < pNode->GetNumRows(); ++row)
+ for (size_t row = 0; row < pNode->GetNumRows(); ++row)
{
m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MMR " ");
- for (int col = 0; col < pNode->GetNumCols(); ++col)
+ for (size_t col = 0; col < pNode->GetNumCols(); ++col)
{
m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " ");
if (const SmNode* node = pNode->GetSubNode(row * pNode->GetNumCols() + col))
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 207e274680c4..510b4d0b2e37 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -1063,13 +1063,15 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmMatrixNode* pNode )
SmCaretPosGraphEntry *left = mpRightMost,
*right = mpGraph->Add( SmCaretPos( pNode, 1 ) );
- for ( sal_uInt16 i = 0; i < pNode->GetNumRows( ); i++ ) {
+ for (size_t i = 0; i < pNode->GetNumRows(); ++i)
+ {
SmCaretPosGraphEntry* r = left;
- for ( sal_uInt16 j = 0; j < pNode->GetNumCols( ); j++ ){
+ for (size_t j = 0; j < pNode->GetNumCols(); ++j)
+ {
SmNode* pSubNode = pNode->GetSubNode( i * pNode->GetNumCols( ) + j );
mpRightMost = mpGraph->Add( SmCaretPos( pSubNode, 0 ), r );
- if( j != 0 || ( pNode->GetNumRows( ) - 1 ) / 2 == i )
+ if( j != 0 || ( pNode->GetNumRows() - 1U ) / 2 == i )
r->SetRight( mpRightMost );
pSubNode->Accept( this );
@@ -1077,7 +1079,7 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmMatrixNode* pNode )
r = mpRightMost;
}
mpRightMost->SetRight( right );
- if( ( pNode->GetNumRows( ) - 1 ) / 2 == i )
+ if( ( pNode->GetNumRows() - 1U ) / 2 == i )
right->SetLeft( mpRightMost );
}
@@ -2281,17 +2283,19 @@ void SmNodeToTextVisitor::Visit( SmSubSupNode* pNode )
void SmNodeToTextVisitor::Visit( SmMatrixNode* pNode )
{
Append( "matrix{" );
- for ( sal_uInt16 i = 0; i < pNode->GetNumRows( ); i++ ) {
- for ( sal_uInt16 j = 0; j < pNode->GetNumCols( ); j++ ) {
+ for (size_t i = 0; i < pNode->GetNumRows(); ++i)
+ {
+ for (size_t j = 0; j < pNode->GetNumCols( ); ++j)
+ {
SmNode* pSubNode = pNode->GetSubNode( i * pNode->GetNumCols( ) + j );
Separate( );
pSubNode->Accept( this );
Separate( );
- if( j != pNode->GetNumCols( ) - 1 )
+ if (j != pNode->GetNumCols() - 1U)
Append( "#" );
}
Separate( );
- if( i != pNode->GetNumRows( ) - 1 )
+ if (i != pNode->GetNumRows() - 1U)
Append( "##" );
}
Append( "} " );