diff options
author | Albert Thuswaldner <albert.thuswaldner@gmail.com> | 2017-07-17 18:37:44 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-07-21 07:54:51 +0200 |
commit | 91325884de5d3c3f838cfdcb1c70d42e5edab149 (patch) | |
tree | a6c55be1a21bf476e1da8a0c3f18999f4461cf76 | |
parent | a9588baca8137f51e2ca72e40b1f448b0e1885d1 (diff) |
tdf#43157 - Clean up OSL_ENSURE and OSL_FAIL in sc/filter/lotus
Change-Id: I88e794752dff1bd46faac71234322d603c10bed9
Reviewed-on: https://gerrit.libreoffice.org/40075
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/filter/lotus/lotattr.cxx | 9 | ||||
-rw-r--r-- | sc/source/filter/lotus/lotform.cxx | 22 | ||||
-rw-r--r-- | sc/source/filter/lotus/lotimpop.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/lotus/lotread.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/lotus/tool.cxx | 4 |
5 files changed, 27 insertions, 26 deletions
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx index 342207d48e3b..d88b963e866b 100644 --- a/sc/source/filter/lotus/lotattr.cxx +++ b/sc/source/filter/lotus/lotattr.cxx @@ -169,8 +169,8 @@ void LotAttrCache::LotusToScBorderLine( sal_uInt8 nLine, ::editeng::SvxBorderLin const SvxColorItem& LotAttrCache::GetColorItem( const sal_uInt8 nLotIndex ) const { - OSL_ENSURE( nLotIndex > 0 && nLotIndex < 7, - "-LotAttrCache::GetColorItem(): caller hast to check index!" ); + // *LotAttrCache::GetColorItem(): caller has to check index! + assert( nLotIndex > 0 && nLotIndex < 7 ); return *ppColorItems[ nLotIndex - 1 ]; } @@ -178,7 +178,8 @@ const SvxColorItem& LotAttrCache::GetColorItem( const sal_uInt8 nLotIndex ) cons const Color& LotAttrCache::GetColor( const sal_uInt8 nLotIndex ) const { // color <-> index fits background, but not for fonts (0 <-> 7)! - OSL_ENSURE( nLotIndex < 8, "*LotAttrCache::GetColor(): Index > 7, caller hast to check index!" ); + // *LotAttrCache::GetColor(): Index > 7, caller hast to check index!" + assert( nLotIndex < 8 ); return pColTab[ nLotIndex ]; } @@ -187,7 +188,7 @@ void LotAttrCol::SetAttr( const SCROW nRow, const ScPatternAttr& rAttr ) { // Actually with the current implementation of MAXROWCOUNT>=64k and nRow // being read as sal_uInt16 there's no chance that nRow would be invalid.. - OSL_ENSURE( ValidRow(nRow), "*LotAttrCol::SetAttr(): ... and failed?!" ); + SAL_WARN_IF( !ValidRow(nRow), "sc", "*LotAttrCol::SetAttr(): ... and failed?!" ); std::vector<std::unique_ptr<ENTRY> >::reverse_iterator iterLast = aEntries.rbegin(); diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index 106c19e3218b..d3c886656145 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -43,7 +43,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri bool bAddIn = false; - OSL_ENSURE( nAnz < 128, "-LotusToSc::DoFunc(): Too many (128)!" ); + SAL_WARN_IF( nAnz > 128, "sc", "-LotusToSc::DoFunc(): Too many (128)!" ); if( eOc == ocNoName ) { @@ -84,7 +84,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri switch( eOc ) { case ocIndex: - OSL_ENSURE( nAnz > 2, "+LotusToSc::DoFunc(): ocIndex needs at least 2 parameters!" ); + SAL_WARN_IF( nAnz < 2, "sc", "+LotusToSc::DoFunc(): ocIndex needs at least 2 parameters!" ); nMerk0 = eParam[ 0 ]; eParam[ 0 ] = eParam[ 1 ]; eParam[ 1 ] = nMerk0; @@ -93,7 +93,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri break; case ocIRR: { - OSL_ENSURE( nAnz == 2, "+LotusToSc::DoFunc(): ocIRR needs 2 parameters!" ); + SAL_WARN_IF( nAnz != 2, "sc", "+LotusToSc::DoFunc(): ocIRR needs 2 parameters!" ); nMerk0 = eParam[ 0 ]; eParam[ 0 ] = eParam[ 1 ]; eParam[ 1 ] = nMerk0; @@ -128,7 +128,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri case ocRate: { // new quantity = 4! - OSL_ENSURE( nAnz == 3, + SAL_WARN_IF( nAnz != 3, "sc", "*LotusToSc::DoFunc(): ZINS() needs 3 parameters!" ); nAnz = 4; eParam[ 3 ] = eParam[ 0 ]; // 3. -> 1. @@ -139,7 +139,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri break; case ocNper: { - OSL_ENSURE( nAnz == 3, + SAL_WARN_IF( nAnz != 3, "sc", "*LotusToSc::DoFunc(): TERM() or CTERM() need 3 parameters!" ); nAnz = 4; if ( OString(pExtString) == "TERM" ) @@ -191,7 +191,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri if( eOc == ocPMT ) { // special case ocPMT, ignore (negate?) last parameter! // additionally: 1. -> 3., 3. -> 2., 2. -> 1. - OSL_ENSURE( nAnz == 3, + SAL_WARN_IF( nAnz != 3, "sc", "+LotusToSc::DoFunc(): ocPMT needs 3 parameters!" ); aPool << eParam[ 1 ] << ocSep << eParam[ 0 ] << ocSep << ocNegSub << eParam[ 2 ]; @@ -272,7 +272,7 @@ void LotusToSc::LotusRelToScRel( sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefDa nRow &= 0x1FFF; break; default: - OSL_FAIL( "*LotusToSc::LotusRelToScRel(): unhandeled case?" ); + SAL_WARN( "sc", "*LotusToSc::LotusRelToScRel(): unhandeled case?" ); } } else @@ -292,7 +292,7 @@ void LotusToSc::LotusRelToScRel( sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefDa nRow &= 0x3FFF; break; default: - OSL_FAIL( "*LotusToSc::LotusRelToScRel(): unhandeled case?" ); + SAL_WARN( "sc", "*LotusToSc::LotusRelToScRel(): unhandeled case?" ); } } @@ -639,14 +639,14 @@ void LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest ) } break; default: - OSL_FAIL( "*LotusToSc::Convert(): unknown enum!" ); + SAL_WARN( "sc", "*LotusToSc::Convert(): unknown enum!" ); } } rpErg = aPool[ aStack.Get() ]; - OSL_ENSURE( nBytesLeft >= 0, "*LotusToSc::Convert(): processed too much!"); - OSL_ENSURE( nBytesLeft <= 0, "*LotusToSc::Convert(): what happens with the rest?" ); + SAL_WARN_IF( nBytesLeft < 0, "sc", "*LotusToSc::Convert(): processed too much!"); + SAL_WARN_IF( nBytesLeft > 0, "sc", "*LotusToSc::Convert(): what happens with the rest?" ); if( rRest ) aIn.SeekRel( nBytesLeft ); // Correct any remainder/overflow diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx index 087f93faacb2..f1e0301218a5 100644 --- a/sc/source/filter/lotus/lotimpop.cxx +++ b/sc/source/filter/lotus/lotimpop.cxx @@ -121,7 +121,7 @@ bool ImportLotus::BofFm3() void ImportLotus::Columnwidth( sal_uInt16 nRecLen ) { - OSL_ENSURE( nRecLen >= 4, "*ImportLotus::Columnwidth(): Record too short!" ); + SAL_WARN_IF( nRecLen < 4, "sc", "*ImportLotus::Columnwidth(): Record too short!" ); sal_uInt8 nLTab, nWindow2; sal_uInt16 nCnt = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 2; @@ -152,7 +152,7 @@ void ImportLotus::Columnwidth( sal_uInt16 nRecLen ) void ImportLotus::Hiddencolumn( sal_uInt16 nRecLen ) { - OSL_ENSURE( nRecLen >= 4, "*ImportLotus::Hiddencolumn(): Record too short!" ); + SAL_WARN_IF( nRecLen < 4, "sc", "*ImportLotus::Hiddencolumn(): Record too short!" ); sal_uInt8 nLTab, nWindow2; sal_uInt16 nCnt = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 2; @@ -260,7 +260,7 @@ void ImportLotus::Smallnumcell() void ImportLotus::Formulacell( sal_uInt16 n ) { - OSL_ENSURE( pIn, "-ImportLotus::Formulacell(): Null-Stream!" ); + SAL_WARN_IF( !pIn, "sc", "-ImportLotus::Formulacell(): Null-Stream!" ); ScAddress aAddr; @@ -289,7 +289,7 @@ void ImportLotus::Read( OUString &r ) void ImportLotus::RowPresentation( sal_uInt16 nRecLen ) { - OSL_ENSURE( nRecLen > 4, "*ImportLotus::RowPresentation(): Record too short!" ); + SAL_WARN_IF( nRecLen < 5, "sc", "*ImportLotus::RowPresentation(): Record too short!" ); sal_uInt8 nLTab, nFlags; sal_uInt16 nRow, nHeight; @@ -376,7 +376,7 @@ void ImportLotus::Font_Ysize() void ImportLotus::Row_( const sal_uInt16 nRecLen ) { - OSL_ENSURE( nExtTab >= 0, "*ImportLotus::Row_(): not possible!" ); + SAL_WARN_IF( nExtTab < 0, "sc", "*ImportLotus::Row_(): not possible!" ); sal_uInt16 nCntDwn = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 5; SCCOL nColCnt = 0; diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx index ce871ba4b49c..0a3da04e1218 100644 --- a/sc/source/filter/lotus/lotread.cxx +++ b/sc/source/filter/lotus/lotread.cxx @@ -185,7 +185,7 @@ ErrCode ImportLotus::Read() break; } - OSL_ENSURE( nNextRec >= pIn->Tell(), + SAL_WARN_IF( nNextRec < pIn->Tell(), "sc", "*ImportLotus::Read(): Read too much..." ); pIn->Seek( nNextRec ); @@ -206,7 +206,7 @@ ErrCode ImportLotus::Read() } for( nCnt = 1 ; nCnt < nTabs ; nCnt++ ) { - OSL_ENSURE( pD->HasTable( nCnt ), + SAL_WARN_IF( !pD->HasTable( nCnt ), "sc", "-ImportLotus::Read(): Where is my table?!" ); pD->GetName( nCnt, aTabName ); if( aTabName == "temp" ) @@ -263,7 +263,7 @@ ErrCode ImportLotus::Read(SvStream& rIn) case 0x0001: // EOF bRead = false; - OSL_ENSURE( nTab == 0, + SAL_WARN_IF( nTab != 0, "sc", "-ImportLotus::Read( SvStream& ): EOF twice!" ); nTab++; break; @@ -290,7 +290,7 @@ ErrCode ImportLotus::Read(SvStream& rIn) break; } - OSL_ENSURE( nNextRec >= pIn->Tell(), + SAL_WARN_IF( nNextRec < pIn->Tell(), "sc", "*ImportLotus::Read(): Read too much..." ); pIn->Seek( nNextRec ); aPrgrsBar.Progress(); diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx index 91c321c11c82..07c1f93a8dd3 100644 --- a/sc/source/filter/lotus/tool.cxx +++ b/sc/source/filter/lotus/tool.cxx @@ -40,7 +40,7 @@ void PutFormString(LotusContext& rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char* pString) { // evaluate Label-Format - OSL_ENSURE( pString != nullptr, "PutFormString(): pString == NULL" ); + SAL_WARN_IF( pString == nullptr, "sc", "PutFormString(): pString == NULL" ); if (!pString) return; @@ -410,7 +410,7 @@ LR_ID LotusRangeList::GetIndex( const LotusRange &rRef ) void LotusRangeList::Append( LotusRange* pLR, const OUString& rName ) { - OSL_ENSURE( pLR, "*LotusRangeList::Append(): no pointer!" ); + SAL_WARN_IF( !pLR, "sc", "*LotusRangeList::Append(): no pointer!" ); maRanges.push_back(pLR); ScTokenArray aTokArray; |