Kaydet (Commit) ab0b2b44 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1426873 Unintended sign extension

and a bunch of others

Change-Id: I110545b74bfc71b17e2e10edc95bc4bb5aa5651c
Reviewed-on: https://gerrit.libreoffice.org/46957Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 617a2fef
......@@ -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, ' ');
......
......@@ -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 ))
......
......@@ -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))
......
......@@ -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( "} " );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment