Kaydet (Commit) d7b48d03 authored tarafından Honza Havlíček's avatar Honza Havlíček Kaydeden (comit) Luboš Luňák

fdo#43157 - Clean up OSL_ENSURE

Change-Id: I5ba15eaa82479aa68b98ce4dcd7827f31b239c98
Reviewed-on: https://gerrit.libreoffice.org/5139Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Tested-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
üst 5f7860bc
......@@ -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()
......
......@@ -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;
}
......
......@@ -23,7 +23,6 @@
#include <assert.h>
#include <tools/solar.h>
#include <osl/diagnose.h>
#include <swdllapi.h>
struct BlockInfo;
......
......@@ -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());
}
......
......@@ -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;
}
......
......@@ -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); }
......
......@@ -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()
......
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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()
......
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