diff options
author | Honza Havlíček <havlicek.honza@gmail.com> | 2013-07-27 03:14:27 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-07-30 13:45:03 +0000 |
commit | d7b48d03e19d2c05ecf2143b1547ceab5ab89e5c (patch) | |
tree | 3a5b49e0f660c3e99321cd268eae1bec68b3a855 | |
parent | 5f7860bc2735bad3cd27552867ce25096835dcbb (diff) |
fdo#43157 - Clean up OSL_ENSURE
Change-Id: I5ba15eaa82479aa68b98ce4dcd7827f31b239c98
Reviewed-on: https://gerrit.libreoffice.org/5139
Reviewed-by: Luboš Luňák <l.lunak@suse.cz>
Tested-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r-- | sw/inc/PostItMgr.hxx | 4 | ||||
-rw-r--r-- | sw/inc/authfld.hxx | 4 | ||||
-rw-r--r-- | sw/inc/bparr.hxx | 1 | ||||
-rw-r--r-- | sw/inc/dcontact.hxx | 7 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 5 | ||||
-rw-r--r-- | sw/inc/switerator.hxx | 4 | ||||
-rw-r--r-- | sw/inc/swrect.hxx | 4 | ||||
-rw-r--r-- | sw/inc/tox.hxx | 43 | ||||
-rw-r--r-- | sw/inc/txatbase.hxx | 33 | ||||
-rw-r--r-- | sw/inc/txtatr.hxx | 2 | ||||
-rw-r--r-- | sw/inc/txtfld.hxx | 2 | ||||
-rw-r--r-- | sw/inc/txtftn.hxx | 2 | ||||
-rw-r--r-- | sw/inc/txtinet.hxx | 2 | ||||
-rw-r--r-- | sw/inc/txtrfmrk.hxx | 2 | ||||
-rw-r--r-- | sw/inc/txttxmrk.hxx | 2 | ||||
-rw-r--r-- | sw/inc/unobaseclass.hxx | 3 |
16 files changed, 52 insertions, 68 deletions
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index c8dc4323bc42..6a605a3aacf1 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -108,9 +108,9 @@ class SwNoteProps: public utl::ConfigItem const ::com::sun::star::uno::Sequence< OUString >& rNames = GetPropertyNames(); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aValues = GetProperties(rNames); const ::com::sun::star::uno::Any* pValues = aValues.getConstArray(); - OSL_ENSURE(aValues.getLength() == rNames.getLength(), "GetProperties failed"); + SAL_WARN_IF(aValues.getLength() != rNames.getLength(), "sw", "GetProperties failed"); if (aValues.getLength()) - pValues[0]>>=bIsShowAnchor; + pValues[0]>>=bIsShowAnchor; } bool IsShowAnchor() diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx index 516120b0b4ef..e38532936967 100644 --- a/sw/inc/authfld.hxx +++ b/sw/inc/authfld.hxx @@ -170,12 +170,12 @@ public: // --- inlines ----------------------------------------------------------- inline OUString SwAuthEntry::GetAuthorField(ToxAuthorityField ePos) const { - OSL_ENSURE(AUTH_FIELD_END > ePos, "wrong index"); + SAL_WARN_IF(AUTH_FIELD_END <= ePos, "sw", "wrong index"); return aAuthFields[ePos]; } inline void SwAuthEntry::SetAuthorField(ToxAuthorityField ePos, const OUString& rField) { - OSL_ENSURE(AUTH_FIELD_END > ePos, "wrong index"); + SAL_WARN_IF(AUTH_FIELD_END <= ePos, "sw", "wrong index"); if(AUTH_FIELD_END > ePos) aAuthFields[ePos] = rField; } diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx index 6cac07cf3d4f..5b0cda20039e 100644 --- a/sw/inc/bparr.hxx +++ b/sw/inc/bparr.hxx @@ -23,7 +23,6 @@ #include <assert.h> #include <tools/solar.h> -#include <osl/diagnose.h> #include <swdllapi.h> struct BlockInfo; diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index eb02ac54bd9c..6dc76cb196c6 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -152,8 +152,7 @@ public: about the object (Writer fly frame resp. drawing object) */ const SwFmtAnchor& GetAnchorFmt() const { - OSL_ENSURE( GetFmt(), - "<SwContact::GetAnchorFmt()> - no frame format -> crash" ); + assert( GetFmt() ); return GetFmt()->GetAnchor(); } @@ -167,9 +166,7 @@ public: const SwPosition& GetCntntAnchor() const { - OSL_ENSURE( GetAnchorFmt().GetCntntAnchor(), - "<SwContact::GetCntntAnchor()> - no content anchor -> crash" ); - + assert( GetAnchorFmt().GetCntntAnchor() ); return *(GetAnchorFmt().GetCntntAnchor()); } diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 8e41570f6df2..125b723608a6 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -28,7 +28,6 @@ #include <modeltoviewhelper.hxx> #include <SwNumberTreeTypes.hxx> #include <IDocumentContentOperations.hxx> -#include <osl/diagnose.h> #include <sfx2/Metadatable.hxx> @@ -818,12 +817,12 @@ public: inline SwpHints & SwTxtNode::GetSwpHints() { - OSL_ASSERT( m_pSwpHints ); + assert( m_pSwpHints ); return *m_pSwpHints; } inline const SwpHints &SwTxtNode::GetSwpHints() const { - OSL_ASSERT( m_pSwpHints ); + assert( m_pSwpHints ); return *m_pSwpHints; } diff --git a/sw/inc/switerator.hxx b/sw/inc/switerator.hxx index 249a8bb317c0..190e14e823ac 100644 --- a/sw/inc/switerator.hxx +++ b/sw/inc/switerator.hxx @@ -20,14 +20,14 @@ #define _SWITERATOR_HXX #include <calbck.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> template< class TElementType, class TSource > class SwIterator { SwClientIter aClientIter; public: - SwIterator( const TSource& rSrc ) : aClientIter(rSrc) { OSL_ENSURE( TElementType::IsOf( TYPE(SwClient) ), "Incompatible types!" ); } + SwIterator( const TSource& rSrc ) : aClientIter(rSrc) { SAL_WARN_IF( !TElementType::IsOf( TYPE(SwClient) ), "sw", "Incompatible types!" ); } TElementType* First() { SwClient* p = aClientIter.First(TYPE(TElementType)); return PTR_CAST(TElementType,p); } TElementType* Last() { SwClient* p = aClientIter.Last( TYPE(TElementType)); return PTR_CAST(TElementType,p); } TElementType* Next() { SwClient* p = aClientIter.Next(); return PTR_CAST(TElementType,p); } diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index 62e521865a24..efe7edf4e8bf 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -18,7 +18,7 @@ */ #ifndef _SWRECT_HXX #define _SWRECT_HXX -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <tools/gen.hxx> class SvStream; @@ -296,7 +296,7 @@ inline SwRect &SwRect::operator-=( const Size &rSz ) // other inline Rectangle SwRect::SVRect() const { - OSL_ENSURE( !IsEmpty(), "SVRect() without Width or Height" ); + SAL_WARN_IF( IsEmpty(), "sw", "SVRect() without Width or Height" ); return Rectangle( m_Point.getX(), m_Point.getY(), m_Point.getX() + m_Size.getWidth() - 1, //Right() m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom() diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx index 4eb7b1d1dfcb..c6231683c213 100644 --- a/sw/inc/tox.hxx +++ b/sw/inc/tox.hxx @@ -24,7 +24,6 @@ #include <i18nlangtag/lang.h> #include <svl/poolitem.hxx> #include <tools/string.hxx> -#include <osl/diagnose.h> #include <editeng/svxenum.hxx> #include <swtypes.hxx> @@ -525,12 +524,12 @@ public: const String& GetStyleNames(sal_uInt16 nLevel) const { - OSL_ENSURE( nLevel < MAXLEVEL, "Which level?"); + SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?"); return aStyleNames[nLevel]; } void SetStyleNames(const String& rSet, sal_uInt16 nLevel) { - OSL_ENSURE( nLevel < MAXLEVEL, "Which level?"); + SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?"); aStyleNames[nLevel] = rSet; } sal_Bool IsFromChapter() const { return bFromChapter;} @@ -591,73 +590,73 @@ inline void SwTOXMark::SetAlternativeText(const String& rAlt) inline void SwTOXMark::SetLevel( sal_uInt16 nLvl ) { - OSL_ENSURE( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); nLevel = nLvl; } inline void SwTOXMark::SetPrimaryKey( const String& rKey ) { - OSL_ENSURE( GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF( GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); aPrimaryKey = rKey; } inline void SwTOXMark::SetSecondaryKey( const String& rKey ) { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); aSecondaryKey = rKey; } inline void SwTOXMark::SetTextReading( const String& rTxt ) { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); aTextReading = rTxt; } inline void SwTOXMark::SetPrimaryKeyReading( const String& rKey ) { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); aPrimaryKeyReading = rKey; } inline void SwTOXMark::SetSecondaryKeyReading( const String& rKey ) { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); aSecondaryKeyReading = rKey; } inline sal_uInt16 SwTOXMark::GetLevel() const { - OSL_ENSURE( !GetTOXType() || GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF( GetTOXType() && GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); return nLevel; } inline const String& SwTOXMark::GetPrimaryKey() const { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); return aPrimaryKey; } inline const String& SwTOXMark::GetSecondaryKey() const { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); return aSecondaryKey; } inline const String& SwTOXMark::GetTextReading() const { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); return aTextReading; } inline const String& SwTOXMark::GetPrimaryKeyReading() const { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); return aPrimaryKeyReading; } inline const String& SwTOXMark::GetSecondaryKeyReading() const { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); return aSecondaryKeyReading; } @@ -666,13 +665,13 @@ inline const String& SwTOXMark::GetSecondaryKeyReading() const // inline void SwForm::SetTemplate(sal_uInt16 nLevel, const String& rTemplate) { - OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX"); + SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()"); aTemplate[nLevel] = rTemplate; } inline const String& SwForm::GetTemplate(sal_uInt16 nLevel) const { - OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX"); + SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()"); return aTemplate[nLevel]; } @@ -730,31 +729,31 @@ inline TOXTypes SwTOXBase::GetType() const inline void SwTOXBase::SetLevel(sal_uInt16 nLev) { - OSL_ENSURE(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); aData.nLevel = nLev; } inline sal_uInt16 SwTOXBase::GetLevel() const { - OSL_ENSURE(GetTOXType()->GetType() != TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() == TOX_INDEX, "sw", "Wrong type"); return aData.nLevel; } inline void SwTOXBase::SetTemplateName(const String& rName) { - OSL_FAIL("SwTOXBase::SetTemplateName obsolete"); + SAL_WARN("sw", "SwTOXBase::SetTemplateName obsolete"); aStyleNames[0] = rName; } inline sal_uInt16 SwTOXBase::GetOptions() const { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); return aData.nOptions; } inline void SwTOXBase::SetOptions(sal_uInt16 nOpt) { - OSL_ENSURE(GetTOXType()->GetType() == TOX_INDEX, "Falscher Feldtyp"); + SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type"); aData.nOptions = nOpt; } diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx index e69b08871fd3..cfa278e337cc 100644 --- a/sw/inc/txatbase.hxx +++ b/sw/inc/txatbase.hxx @@ -148,7 +148,7 @@ inline const xub_StrLen* SwTxtAttr::GetAnyEnd() const inline const SfxPoolItem& SwTxtAttr::GetAttr() const { - OSL_ENSURE( m_pAttr, "SwTxtAttr: where is my attribute?" ); + assert( m_pAttr ); return *m_pAttr; } @@ -170,71 +170,62 @@ inline void SwTxtAttr::SetDontExpand( bool bDontExpand ) inline const SwFmtCharFmt& SwTxtAttr::GetCharFmt() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_CHARFMT, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_CHARFMT ); return (const SwFmtCharFmt&)(*m_pAttr); } inline const SwFmtAutoFmt& SwTxtAttr::GetAutoFmt() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_AUTOFMT, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_AUTOFMT ); return (const SwFmtAutoFmt&)(*m_pAttr); } inline const SwFmtFld& SwTxtAttr::GetFld() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD ); return (const SwFmtFld&)(*m_pAttr); } inline const SwFmtFtn& SwTxtAttr::GetFtn() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_FTN, "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FTN ); return (const SwFmtFtn&)(*m_pAttr); } inline const SwFmtFlyCnt& SwTxtAttr::GetFlyCnt() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_FLYCNT, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FLYCNT ); return (const SwFmtFlyCnt&)(*m_pAttr); } inline const SwTOXMark& SwTxtAttr::GetTOXMark() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_TOXMARK, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_TOXMARK ); return (const SwTOXMark&)(*m_pAttr); } inline const SwFmtRefMark& SwTxtAttr::GetRefMark() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_REFMARK, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_REFMARK ); return (const SwFmtRefMark&)(*m_pAttr); } inline const SwFmtINetFmt& SwTxtAttr::GetINetFmt() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_INETFMT, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_INETFMT ); return (const SwFmtINetFmt&)(*m_pAttr); } inline const SwFmtRuby& SwTxtAttr::GetRuby() const { - OSL_ENSURE( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY, - "Wrong attribute" ); + assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY ); return (const SwFmtRuby&)(*m_pAttr); } inline const SwFmtMeta& SwTxtAttr::GetMeta() const { - OSL_ENSURE( m_pAttr && (m_pAttr->Which() == RES_TXTATR_META || - m_pAttr->Which() == RES_TXTATR_METAFIELD), - "Wrong attribute" ); + assert( m_pAttr && (m_pAttr->Which() == RES_TXTATR_META || + m_pAttr->Which() == RES_TXTATR_METAFIELD) ); return (const SwFmtMeta&)(*m_pAttr); } diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index 08363b791610..d28112979800 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -113,7 +113,7 @@ public: inline const SwTxtNode& SwTxtRuby::GetTxtNode() const { - OSL_ENSURE( m_pTxtNode, "SwTxtRuby: where is my TxtNode?" ); + assert( m_pTxtNode ); return *m_pTxtNode; } diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx index 5368aa55c165..b12be7a501e1 100644 --- a/sw/inc/txtfld.hxx +++ b/sw/inc/txtfld.hxx @@ -56,7 +56,7 @@ public: inline SwTxtNode& SwTxtFld::GetTxtNode() const { - OSL_ENSURE( m_pTxtNode, "SwTxtFld:: where is my TxtNode?" ); + assert( m_pTxtNode ); return *m_pTxtNode; } diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx index 471acd112998..63a097bb34aa 100644 --- a/sw/inc/txtftn.hxx +++ b/sw/inc/txtftn.hxx @@ -68,7 +68,7 @@ public: inline const SwTxtNode& SwTxtFtn::GetTxtNode() const { - OSL_ENSURE( m_pTxtNode, "SwTxtFtn: where is my TxtNode?" ); + assert( m_pTxtNode ); return *m_pTxtNode; } diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx index 7812e7b59261..fe54103424a0 100644 --- a/sw/inc/txtinet.hxx +++ b/sw/inc/txtinet.hxx @@ -66,7 +66,7 @@ public: inline const SwTxtNode& SwTxtINetFmt::GetTxtNode() const { - OSL_ENSURE( m_pTxtNode, "SwTxtINetFmt: where is my TxtNode?" ); + assert( m_pTxtNode ); return *m_pTxtNode; } diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx index 297038f01fc3..c91bda483fd1 100644 --- a/sw/inc/txtrfmrk.hxx +++ b/sw/inc/txtrfmrk.hxx @@ -45,7 +45,7 @@ public: inline const SwTxtNode& SwTxtRefMark::GetTxtNode() const { - OSL_ENSURE( m_pTxtNode, "SwTxtRefMark: where is my TxtNode?" ); + assert( m_pTxtNode ); return *m_pTxtNode; } diff --git a/sw/inc/txttxmrk.hxx b/sw/inc/txttxmrk.hxx index 7faebc0d4b04..5969f339a184 100644 --- a/sw/inc/txttxmrk.hxx +++ b/sw/inc/txttxmrk.hxx @@ -50,7 +50,7 @@ public: inline const SwTxtNode& SwTxtTOXMark::GetTxtNode() const { - OSL_ENSURE( m_pTxtNode, "SwTxtTOXMark: where is my TxtNode?" ); + assert( m_pTxtNode ); return *m_pTxtNode; } diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx index 3537cd2769cc..483bd2927530 100644 --- a/sw/inc/unobaseclass.hxx +++ b/sw/inc/unobaseclass.hxx @@ -87,7 +87,6 @@ void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem #include <boost/utility.hpp> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -103,7 +102,7 @@ namespace sw { UnoImplPtr(T *const i_p) : m_p(i_p) { - OSL_ENSURE(i_p, "UnoImplPtr: null"); + SAL_WARN_IF(!i_p, "sw", "UnoImplPtr: null"); } ~UnoImplPtr() |