diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-12-01 19:26:09 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-12-01 23:12:56 +0100 |
commit | 17fd1d8848df8fa97818b024a510bec98d8fc9d5 (patch) | |
tree | 88a8cf676b992b7df572c4217f48f977bdade21a /editeng | |
parent | 7a242b463132d67a4a2d6e69319e0da367145cc0 (diff) |
editeng: don't hide the DbgCheckAttribs() behind OSL_DEBUG_LEVEL > 2
... and add a check for fdo#85496 too.
Change-Id: I235057362bcac23fa64e79f1b47311328e01a81a
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 23 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 5 |
2 files changed, 15 insertions, 13 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 54cdb909312d..15be683b2665 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1559,9 +1559,7 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode ) sal_Int32 nNewStart = maString.getLength(); -#if OSL_DEBUG_LEVEL > 2 - OSL_ENSURE( aCharAttribList.DbgCheckAttribs(), "Attribute before AppendAttribs broken" ); -#endif + OSL_ENSURE( CharAttribList::DbgCheckAttribs(aCharAttribList), "Attribute before AppendAttribs broken" ); sal_Int32 nAttr = 0; CharAttribList::AttribsType& rNextAttribs = pNextNode->GetCharAttribs().GetAttribs(); @@ -1615,9 +1613,7 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode ) // For the Attributes that just moved over: rNextAttribs.clear(); -#if OSL_DEBUG_LEVEL > 2 - OSL_ENSURE( aCharAttribList.DbgCheckAttribs(), "Attribute after AppendAttribs broken" ); -#endif + OSL_ENSURE( CharAttribList::DbgCheckAttribs(aCharAttribList), "Attribute after AppendAttribs broken" ); } void ContentNode::CreateDefFont() @@ -2987,11 +2983,13 @@ void CharAttribList::DeleteEmptyAttribs( SfxItemPool& rItemPool ) bHasEmptyAttribs = false; } -#if OSL_DEBUG_LEVEL > 2 -bool CharAttribList::DbgCheckAttribs() const +#if OSL_DEBUG_LEVEL > 0 +bool CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs) { bool bOK = true; - AttribsType::const_iterator it = aAttribs.begin(), itEnd = aAttribs.end(); + 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; @@ -3000,11 +2998,16 @@ bool CharAttribList::DbgCheckAttribs() const bOK = false; OSL_FAIL( "Attribute is distorted" ); } - else if (rAttr.IsFeature() && rAttr.GetLen() != 1) + if (rAttr.IsFeature() && rAttr.GetLen() != 1) { bOK = false; OSL_FAIL( "Feature, Len != 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; } diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 612786fd386a..7cbbd4322a0c 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -229,9 +229,8 @@ public: void Remove(sal_Int32 nPos); void Release(const EditCharAttrib* p); -#if OSL_DEBUG_LEVEL > 2 - // Debug: - bool DbgCheckAttribs() const; +#if OSL_DEBUG_LEVEL > 0 + static bool DbgCheckAttribs(CharAttribList const& rAttribs); #endif }; |