diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-06 10:03:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-06 11:57:45 +0000 |
commit | 0ddae2167e7d52bf0f2bda323100f5ebb4ab3dc0 (patch) | |
tree | e318d2c7969e5c2ea69329c5bde8d7daf3a1397b /lotuswordpro/source | |
parent | coverity#1158398 Uncaught exception (diff) | |
download | core-0ddae2167e7d52bf0f2bda323100f5ebb4ab3dc0.tar.gz core-0ddae2167e7d52bf0f2bda323100f5ebb4ab3dc0.zip |
coverity#705403 Argument cannot be negative
Change-Id: I0cf67a4bd5ec95e135511611c236350d4347895e
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 6 | ||||
-rw-r--r-- | lotuswordpro/source/filter/xfilter/xftable.cxx | 18 | ||||
-rw-r--r-- | lotuswordpro/source/filter/xfilter/xftable.hxx | 14 |
3 files changed, 16 insertions, 22 deletions
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index c40c37606b0b..b8193b4ca63d 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -845,7 +845,7 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow( ConvertTable(pTmpTable,nStartHeadRow,nEndHeadRow,0,nCol); - sal_uInt16 nRowNum = static_cast<sal_uInt16>(pTmpTable->GetRowCount()); + sal_uInt16 nRowNum = pTmpTable->GetRowCount(); sal_uInt8* CellMark = new sal_uInt8[nRowNum]; sal_Bool bFindFlag = sal_False; @@ -884,7 +884,7 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable,XFTable* pXFTable, { sal_uInt16 i; sal_uInt8 j; - sal_uInt16 nRowNum = static_cast<sal_uInt16>(pTmpTable->GetRowCount()); + sal_uInt16 nRowNum = pTmpTable->GetRowCount(); sal_uInt8 nCol = static_cast<sal_uInt8>(GetTable()->GetColumn()); XFRow* pXFRow = new XFRow; @@ -981,7 +981,7 @@ void LwpTableLayout::SplitRowToCells(XFTable* pTmpTable,XFTable* pXFTable, sal_Bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable,sal_uInt8* pCellMark, sal_uInt8& nMaxColSpan) { - sal_uInt16 nRowNum = static_cast<sal_uInt16>(pXFTable->GetRowCount()); + sal_uInt16 nRowNum = pXFTable->GetRowCount(); sal_uInt8 nColNum = static_cast<sal_uInt8>(pXFTable->GetColumnCount()); sal_uInt8 nCellMark=0; sal_uInt8 nCount; diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx index 678a1a12d627..0b193ae11e86 100644 --- a/lotuswordpro/source/filter/xfilter/xftable.cxx +++ b/lotuswordpro/source/filter/xfilter/xftable.cxx @@ -115,12 +115,11 @@ XFTable& XFTable::operator =(const XFTable& other) XFTable::~XFTable() { - std::map<sal_Int32,XFRow*>::iterator it; + std::map<sal_uInt16, XFRow*>::iterator it; for( it=m_aRows.begin(); it!=m_aRows.end(); ++it ) { XFRow *pRow = (*it).second; - if( pRow ) - delete pRow; + delete pRow; } m_aRows.clear(); m_aColumns.clear(); @@ -167,13 +166,13 @@ OUString XFTable::GetTableName() return m_strName; } -sal_Int32 XFTable::GetRowCount() +sal_uInt16 XFTable::GetRowCount() { - sal_Int32 rowMax = -1; - std::map<sal_Int32,XFRow*>::iterator it; + sal_uInt16 rowMax = 0; + std::map<sal_uInt16, XFRow*>::iterator it; for( it=m_aRows.begin(); it!=m_aRows.end(); ++it ) { - if( it->first>rowMax ) + if (it->first > rowMax) rowMax = it->first; } @@ -219,9 +218,6 @@ void XFTable::ToXml(IXFStream *pStrm) else pStrm->StartElement( A2OUSTR("table:table") ); - //test code -// sal_Int32 rowMax = GetRowCount(); -// sal_Int32 colMax = GetColumnCount(); //output columns: { int lastCol = 0; @@ -267,7 +263,7 @@ void XFTable::ToXml(IXFStream *pStrm) int lastRow = 0; pAttrList = pStrm->GetAttrList(); - std::map<sal_Int32,XFRow* >::iterator it = m_aRows.begin(); + std::map<sal_uInt16, XFRow* >::iterator it = m_aRows.begin(); for( ; it!=m_aRows.end(); ++it ) { int row = (*it).first; diff --git a/lotuswordpro/source/filter/xfilter/xftable.hxx b/lotuswordpro/source/filter/xfilter/xftable.hxx index e9ae0229603b..8dae00a67265 100644 --- a/lotuswordpro/source/filter/xfilter/xftable.hxx +++ b/lotuswordpro/source/filter/xfilter/xftable.hxx @@ -98,7 +98,7 @@ public: OUString GetTableName(); - sal_Int32 GetRowCount(); + sal_uInt16 GetRowCount(); XFRow* GetRow(sal_Int32 row); @@ -112,14 +112,17 @@ public: virtual void ToXml(IXFStream *pStrm); - void RemoveRow(sal_Int32 row); + void RemoveRow(sal_uInt16 row) + { + m_aRows.erase(row); + } private: OUString m_strName; sal_Bool m_bSubTable; XFCell *m_pOwnerCell; XFContentContainer m_aHeaderRows; - std::map<sal_Int32,XFRow*> m_aRows; + std::map<sal_uInt16, XFRow*> m_aRows; std::map<sal_Int32,OUString> m_aColumns; OUString m_strDefCellStyle; OUString m_strDefRowStyle; @@ -158,11 +161,6 @@ inline void XFTable::SetDefaultColStyle(OUString style) m_strDefColStyle = style; } -inline void XFTable::RemoveRow(sal_Int32 row) -{ - m_aRows.erase(row); -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |