Kaydet (Commit) f62d2228 authored tarafından Gökhan Gurbetoğlu's avatar Gökhan Gurbetoğlu Kaydeden (comit) Michael Stahl

tdf#43157 - Clean up OSL_ASSERT, DBG_ASSERT, etc.

Change-Id: I8114e338451b5b2e79b2318f558cbd075f024f08
Reviewed-on: https://gerrit.libreoffice.org/28584Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 6004f5c6
...@@ -32,7 +32,7 @@ namespace accessibility ...@@ -32,7 +32,7 @@ namespace accessibility
{ {
void SfxListenerGuard::startListening(::SfxBroadcaster & rNotifier) void SfxListenerGuard::startListening(::SfxBroadcaster & rNotifier)
{ {
OSL_ENSURE(m_pNotifier == nullptr, "called more than once"); assert(m_pNotifier == nullptr && "called more than once");
m_pNotifier = &rNotifier; m_pNotifier = &rNotifier;
m_rListener.StartListening(*m_pNotifier, true); m_rListener.StartListening(*m_pNotifier, true);
} }
...@@ -48,7 +48,7 @@ void SfxListenerGuard::endListening() ...@@ -48,7 +48,7 @@ void SfxListenerGuard::endListening()
void WindowListenerGuard::startListening(vcl::Window & rNotifier) void WindowListenerGuard::startListening(vcl::Window & rNotifier)
{ {
OSL_ENSURE(m_pNotifier == nullptr, "called more than once"); assert(m_pNotifier == nullptr && "called more than once");
m_pNotifier = &rNotifier; m_pNotifier = &rNotifier;
m_pNotifier->AddEventListener(m_aListener); m_pNotifier->AddEventListener(m_aListener);
} }
...@@ -278,11 +278,9 @@ void SAL_CALL Paragraph::grabFocus() throw (css::uno::RuntimeException, std::exc ...@@ -278,11 +278,9 @@ void SAL_CALL Paragraph::grabFocus() throw (css::uno::RuntimeException, std::exc
} }
catch (const css::lang::IndexOutOfBoundsException & rEx) catch (const css::lang::IndexOutOfBoundsException & rEx)
{ {
OSL_TRACE( SAL_INFO("accessibility",
"textwindowaccessibility.cxx: Paragraph::grabFocus:" "textwindowaccessibility.cxx: Paragraph::grabFocus: caught unexpected "
" caught unexpected %s\n", << rEx.Message);
OUStringToOString(rEx.Message, RTL_TEXTENCODING_UTF8).
getStr());
} }
} }
...@@ -1879,8 +1877,7 @@ void Document::handleParagraphNotifications() ...@@ -1879,8 +1877,7 @@ void Document::handleParagraphNotifications()
case TEXT_HINT_PARAINSERTED: case TEXT_HINT_PARAINSERTED:
{ {
::sal_uLong n = aHint.GetValue(); ::sal_uLong n = aHint.GetValue();
OSL_ENSURE(n <= m_xParagraphs->size(), assert(n <= m_xParagraphs->size() && "bad TEXT_HINT_PARAINSERTED event");
"bad TEXT_HINT_PARAINSERTED event");
// Save the values of old iterators (the iterators themselves // Save the values of old iterators (the iterators themselves
// will get invalidated), and adjust the old values so that they // will get invalidated), and adjust the old values so that they
...@@ -1953,8 +1950,7 @@ void Document::handleParagraphNotifications() ...@@ -1953,8 +1950,7 @@ void Document::handleParagraphNotifications()
} }
else else
{ {
OSL_ENSURE(n < m_xParagraphs->size(), assert(n < m_xParagraphs->size() && "Bad TEXT_HINT_PARAREMOVED event");
"Bad TEXT_HINT_PARAREMOVED event");
Paragraphs::iterator aIt(m_xParagraphs->begin() + n); Paragraphs::iterator aIt(m_xParagraphs->begin() + n);
// numeric overflow cannot occur // numeric overflow cannot occur
...@@ -1998,8 +1994,7 @@ void Document::handleParagraphNotifications() ...@@ -1998,8 +1994,7 @@ void Document::handleParagraphNotifications()
--m_nSelectionLastPara; --m_nSelectionLastPara;
else if (sal::static_int_cast<sal_Int32>(n) == m_nSelectionLastPara) else if (sal::static_int_cast<sal_Int32>(n) == m_nSelectionLastPara)
{ {
OSL_ENSURE(m_nSelectionFirstPara < m_nSelectionLastPara, assert(m_nSelectionFirstPara < m_nSelectionLastPara && "logic error");
"logic error");
--m_nSelectionLastPara; --m_nSelectionLastPara;
m_nSelectionLastPos = 0x7FFFFFFF; m_nSelectionLastPos = 0x7FFFFFFF;
} }
...@@ -2047,8 +2042,7 @@ void Document::handleParagraphNotifications() ...@@ -2047,8 +2042,7 @@ void Document::handleParagraphNotifications()
case TEXT_HINT_FORMATPARA: case TEXT_HINT_FORMATPARA:
{ {
::sal_uLong n = aHint.GetValue(); ::sal_uLong n = aHint.GetValue();
OSL_ENSURE(n < m_xParagraphs->size(), assert(n < m_xParagraphs->size() && "Bad TEXT_HINT_FORMATPARA event");
"Bad TEXT_HINT_FORMATPARA event");
(*m_xParagraphs)[static_cast< Paragraphs::size_type >(n)]. (*m_xParagraphs)[static_cast< Paragraphs::size_type >(n)].
changeHeight(static_cast< ::sal_Int32 >( changeHeight(static_cast< ::sal_Int32 >(
...@@ -2070,7 +2064,7 @@ void Document::handleParagraphNotifications() ...@@ -2070,7 +2064,7 @@ void Document::handleParagraphNotifications()
break; break;
} }
default: default:
OSL_FAIL( "bad buffered hint"); SAL_WARN("accessibility", "bad buffered hint");
break; break;
} }
} }
...@@ -2211,9 +2205,9 @@ void Document::sendEvent(::sal_Int32 start, ::sal_Int32 end, ::sal_Int16 nEventI ...@@ -2211,9 +2205,9 @@ void Document::sendEvent(::sal_Int32 start, ::sal_Int32 end, ::sal_Int16 nEventI
void Document::handleSelectionChangeNotification() void Document::handleSelectionChangeNotification()
{ {
::TextSelection const & rSelection = m_rView.GetSelection(); ::TextSelection const & rSelection = m_rView.GetSelection();
OSL_ENSURE(rSelection.GetStart().GetPara() < m_xParagraphs->size() assert(rSelection.GetStart().GetPara() < m_xParagraphs->size() &&
&& rSelection.GetEnd().GetPara() < m_xParagraphs->size(), rSelection.GetEnd().GetPara() < m_xParagraphs->size() &&
"bad TEXT_HINT_VIEWSELECTIONCHANGED event"); "bad TEXT_HINT_VIEWSELECTIONCHANGED event");
::sal_Int32 nNewFirstPara ::sal_Int32 nNewFirstPara
= static_cast< ::sal_Int32 >(rSelection.GetStart().GetPara()); = static_cast< ::sal_Int32 >(rSelection.GetStart().GetPara());
::sal_Int32 nNewFirstPos = rSelection.GetStart().GetIndex(); ::sal_Int32 nNewFirstPos = rSelection.GetStart().GetIndex();
......
...@@ -429,7 +429,7 @@ AnimationNode::AnimationNode( sal_Int16 nNodeType ) ...@@ -429,7 +429,7 @@ AnimationNode::AnimationNode( sal_Int16 nNodeType )
mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE ), mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE ),
mfIterateInterval(0.0) mfIterateInterval(0.0)
{ {
OSL_ENSURE((sal_uInt32)nNodeType < sizeof(mpTypes)/sizeof(Sequence<Type>*), "NodeType out of range"); assert((sal_uInt32)nNodeType < sizeof(mpTypes)/sizeof(Sequence<Type>*));
} }
AnimationNode::AnimationNode( const AnimationNode& rNode ) AnimationNode::AnimationNode( const AnimationNode& rNode )
...@@ -1215,7 +1215,7 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone() throw (RuntimeExce ...@@ -1215,7 +1215,7 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone() throw (RuntimeExce
} }
catch(const Exception&) catch(const Exception&)
{ {
OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" ); SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
} }
} }
} }
...@@ -1223,7 +1223,7 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone() throw (RuntimeExce ...@@ -1223,7 +1223,7 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone() throw (RuntimeExce
} }
catch(const Exception&) catch(const Exception&)
{ {
OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" ); SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
} }
return xNewNode; return xNewNode;
......
...@@ -620,8 +620,9 @@ namespace basegfx ...@@ -620,8 +620,9 @@ namespace basegfx
default: default:
{ {
OSL_FAIL("importFromSvgD(): skipping tags in svg:d element (unknown)!"); SAL_WARN("basegfx", "importFromSvgD(): skipping tags in svg:d element (unknown: \""
OSL_TRACE("importFromSvgD(): skipping tags in svg:d element (unknown: \"%c\")!", aCurrChar); << aCurrChar
<< "\")!");
++nPos; ++nPos;
break; break;
} }
...@@ -665,7 +666,7 @@ namespace basegfx ...@@ -665,7 +666,7 @@ namespace basegfx
OUString exportToSvgPoints( const B2DPolygon& rPoly ) OUString exportToSvgPoints( const B2DPolygon& rPoly )
{ {
OSL_ENSURE(!rPoly.areControlPointsUsed(), "exportToSvgPoints: Only non-bezier polygons allowed (!)"); SAL_WARN_IF(rPoly.areControlPointsUsed(), "basegfx", "exportToSvgPoints: Only non-bezier polygons allowed (!)");
const sal_uInt32 nPointCount(rPoly.count()); const sal_uInt32 nPointCount(rPoly.count());
OUStringBuffer aResult; OUStringBuffer aResult;
......
...@@ -536,6 +536,7 @@ certain functionality. ...@@ -536,6 +536,7 @@ certain functionality.
@section other @section other
@li @c accessibility @li @c accessibility
@li @c animations
@li @c basegfx @li @c basegfx
@li @c binaryurp @li @c binaryurp
@li @c configmgr @li @c configmgr
......
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