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

coverity#1242775 Use of untrusted scalar value

and coverity#1242728
and coverity#1242836
and coverity#1242927
and coverity#1242942
and coverity#1242937
and coverity#1242793
and coverity#1242945

move the casts to one single place before they get
scrutinized

Change-Id: I8a14f8d22b5c38d04f4fb538a1eb0baeef04e390
üst cced2f6b
...@@ -330,16 +330,17 @@ void ImportLotus::RowPresentation( sal_uInt16 nRecLen ) ...@@ -330,16 +330,17 @@ void ImportLotus::RowPresentation( sal_uInt16 nRecLen )
void ImportLotus::NamedSheet( void ) void ImportLotus::NamedSheet( void )
{ {
sal_uInt16 nLTab; sal_uInt16 nTmpTab(0);
OUString aName; Read(nTmpTab);
OUString aName;
Read(aName);
Read( nLTab ); SCTAB nLTab(static_cast<SCTAB>(nTmpTab));
Read( aName );
if( pD->HasTable( static_cast<SCTAB> (nLTab) ) ) if (pD->HasTable(nLTab))
pD->RenameTab( static_cast<SCTAB> (nLTab), aName ); pD->RenameTab(nLTab, aName);
else else
pD->InsertTab( static_cast<SCTAB> (nLTab), aName ); pD->InsertTab(nLTab, aName);
} }
void ImportLotus::Font_Face( void ) void ImportLotus::Font_Face( void )
...@@ -384,8 +385,6 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen ) ...@@ -384,8 +385,6 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
{ {
OSL_ENSURE( nExtTab >= 0, "*ImportLotus::_Row(): not possible!" ); OSL_ENSURE( nExtTab >= 0, "*ImportLotus::_Row(): not possible!" );
sal_uInt16 nRow;
sal_uInt16 nHeight;
sal_uInt16 nCntDwn = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 5; sal_uInt16 nCntDwn = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 5;
SCCOL nColCnt = 0; SCCOL nColCnt = 0;
sal_uInt8 nRepeats; sal_uInt8 nRepeats;
...@@ -394,14 +393,19 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen ) ...@@ -394,14 +393,19 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
bool bCenter = false; bool bCenter = false;
SCCOL nCenterStart = 0, nCenterEnd = 0; SCCOL nCenterStart = 0, nCenterEnd = 0;
Read( nRow ); sal_uInt16 nTmpRow(0);
Read( nHeight ); Read(nTmpRow);
SCROW nRow(static_cast<SCROW>(nTmpRow));
sal_uInt16 nHeight(0);
Read(nHeight);
nHeight &= 0x0FFF; nHeight &= 0x0FFF;
nHeight *= 22; nHeight *= 22;
SCTAB nDestTab(static_cast<SCTAB>(nExtTab));
if( nHeight ) if( nHeight )
pD->SetRowHeight( static_cast<SCROW> (nRow), static_cast<SCTAB> (nExtTab), nHeight ); pD->SetRowHeight(nRow, nDestTab, nHeight);
LotusContext &rContext = aConv.getContext(); LotusContext &rContext = aConv.getContext();
while( nCntDwn ) while( nCntDwn )
...@@ -411,36 +415,39 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen ) ...@@ -411,36 +415,39 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
if( aAttr.HasStyles() ) if( aAttr.HasStyles() )
rContext.pLotusRoot->pAttrTable->SetAttr( rContext.pLotusRoot->pAttrTable->SetAttr(
nColCnt, static_cast<SCCOL> ( nColCnt + nRepeats ), static_cast<SCROW> (nRow), aAttr ); nColCnt, static_cast<SCCOL> ( nColCnt + nRepeats ), nRow, aAttr );
// Do this here and NOT in class LotAttrTable, as we only add attributes if the other // Do this here and NOT in class LotAttrTable, as we only add attributes if the other
// attributes are set // attributes are set
// -> for Center-Attribute default is centered // -> for Center-Attribute default is centered
if( aAttr.IsCentered() ) if( aAttr.IsCentered() )
{ {
if( bCenter ) if( bCenter )
{
if (pD->HasData(nColCnt, nRow, nDestTab))
{ {
if( pD->HasData( nColCnt, static_cast<SCROW> (nRow), static_cast<SCTAB> (nExtTab) ) ) // new Center after previous Center
{// new Center after previous Center pD->DoMerge(nDestTab, nCenterStart, nRow, nCenterEnd, nRow);
pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) );
nCenterStart = nColCnt; nCenterStart = nColCnt;
}
} }
}
else else
{// fully new Center {
// fully new Center
bCenter = true; bCenter = true;
nCenterStart = nColCnt; nCenterStart = nColCnt;
}
nCenterEnd = nColCnt + static_cast<SCCOL>(nRepeats);
} }
nCenterEnd = nColCnt + static_cast<SCCOL>(nRepeats);
}
else else
{ {
if( bCenter ) if( bCenter )
{// possibly reset old Center {
pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) ); // possibly reset old Center
pD->DoMerge(nDestTab, nCenterStart, nRow, nCenterEnd, nRow);
bCenter = false; bCenter = false;
}
} }
}
nColCnt = nColCnt + static_cast<SCCOL>(nRepeats); nColCnt = nColCnt + static_cast<SCCOL>(nRepeats);
nColCnt++; nColCnt++;
...@@ -450,6 +457,6 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen ) ...@@ -450,6 +457,6 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
if( bCenter ) if( bCenter )
// possibly reset old Center // possibly reset old Center
pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) ); pD->DoMerge(nDestTab, nCenterStart, nRow, nCenterEnd, nRow);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
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