summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-12-02 22:48:01 +0100
committerMichael Stahl <mstahl@redhat.com>2014-12-03 13:13:29 +0100
commit4c21d3ac912bdb7eb013d3ee440464489a3838b7 (patch)
treed21c06530ab25c0b5e53dc636d9b64ca5247cfcd /editeng
parent54988348f847f4712d8a168a3baf2a1fc2f3d5ac (diff)
editeng: convert that to assert
Change-Id: I03e43d35efb813f985b93bc05c3b50c4462f9111
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx32
-rw-r--r--editeng/source/editeng/editdoc.hxx2
2 files changed, 14 insertions, 20 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index e763cc6597a3..9eb25bb6d421 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -847,12 +847,12 @@ ParaPortion* ParaPortionList::SafeGetObject(sal_Int32 nPos)
void
ParaPortionList::DbgCheck(ParaPortionList const& rParas, EditDoc const& rDoc)
{
- DBG_ASSERT( rParas.Count() == rDoc.Count(), "ParaPortionList::DbgCheck() - Count() unequal!" );
+ assert(rParas.Count() == rDoc.Count());
for (sal_Int32 i = 0; i < rParas.Count(); ++i)
{
- DBG_ASSERT( rParas.SafeGetObject(i), "ParaPortionList::DbgCheck() - Null-Pointer in List!" );
- DBG_ASSERT( rParas.SafeGetObject(i)->GetNode(), "ParaPortionList::DbgCheck() - Null-Pointer in List(2)!" );
- DBG_ASSERT( rParas.SafeGetObject(i)->GetNode() == rDoc.GetObject(i), "ParaPortionList::DbgCheck() - Entries intersect!" );
+ assert(rParas.SafeGetObject(i) != nullptr);
+ assert(rParas.SafeGetObject(i)->GetNode() != nullptr);
+ assert(rParas.SafeGetObject(i)->GetNode() == rDoc.GetObject(i));
}
}
#endif
@@ -1560,7 +1560,9 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode )
sal_Int32 nNewStart = maString.getLength();
- OSL_ENSURE( CharAttribList::DbgCheckAttribs(aCharAttribList), "Attribute before AppendAttribs broken" );
+#if OSL_DEBUG_LEVEL > 0
+ CharAttribList::DbgCheckAttribs(aCharAttribList);
+#endif
sal_Int32 nAttr = 0;
CharAttribList::AttribsType& rNextAttribs = pNextNode->GetCharAttribs().GetAttribs();
@@ -1614,7 +1616,9 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode )
// For the Attributes that just moved over:
rNextAttribs.clear();
- OSL_ENSURE( CharAttribList::DbgCheckAttribs(aCharAttribList), "Attribute after AppendAttribs broken" );
+#if OSL_DEBUG_LEVEL > 0
+ CharAttribList::DbgCheckAttribs(aCharAttribList);
+#endif
}
void ContentNode::CreateDefFont()
@@ -2985,32 +2989,22 @@ void CharAttribList::DeleteEmptyAttribs( SfxItemPool& rItemPool )
}
#if OSL_DEBUG_LEVEL > 0
-bool CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs)
+void CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs)
{
- bool bOK = true;
AttribsType::const_iterator it = rAttribs.aAttribs.begin();
AttribsType::const_iterator itEnd = rAttribs.aAttribs.end();
std::set<std::pair<sal_Int32, sal_uInt16>> zero_set;
for (; it != itEnd; ++it)
{
const EditCharAttrib& rAttr = *it;
- if (rAttr.GetStart() > rAttr.GetEnd())
- {
- bOK = false;
- OSL_FAIL( "Attribute is distorted" );
- }
- if (rAttr.IsFeature() && rAttr.GetLen() != 1)
- {
- bOK = false;
- OSL_FAIL( "Feature, Len != 1" );
- }
+ assert(rAttr.GetStart() <= rAttr.GetEnd());
+ assert(!rAttr.IsFeature() || rAttr.GetLen() == 1);
if (0 == rAttr.GetLen())
{
// not sure if 0-length attributes allowed at all in non-empty para?
assert(zero_set.insert(std::make_pair(rAttr.GetStart(), rAttr.Which())).second && "duplicate 0-length attribute detected");
}
}
- return bOK;
}
#endif
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 1c5703bcd0dc..5a1d2e39c50e 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -230,7 +230,7 @@ public:
void Release(const EditCharAttrib* p);
#if OSL_DEBUG_LEVEL > 0
- static bool DbgCheckAttribs(CharAttribList const& rAttribs);
+ static void DbgCheckAttribs(CharAttribList const& rAttribs);
#endif
};