diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-06-12 20:11:20 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-17 06:38:57 +0000 |
commit | 9c79945ca62b18213728cdd23d9f390304aee1de (patch) | |
tree | 94bb9cc30cbb5bb5508875d80fcf975b673fe0ac /vcl/source | |
parent | 29e91d5eedd2bf20504ce9ada625d33fec19dc9e (diff) |
convert DBG_ASSERT in vcl
Change-Id: I732fb1a789f90ca7a7f393cc41a6afe84fecf3d3
Reviewed-on: https://gerrit.libreoffice.org/26200
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl/source')
75 files changed, 301 insertions, 301 deletions
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 8c1f902fa684..1e5da117c995 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -452,7 +452,7 @@ IMPL_LINK_TYPED( HelpTextWindow, TimerHdl, Timer*, pTimer, void) } else { - DBG_ASSERT( pTimer == &maHideTimer, "HelpTextWindow::TimerHdl with bad Timer" ); + SAL_WARN_IF( pTimer != &maHideTimer, "vcl", "HelpTextWindow::TimerHdl with bad Timer" ); ImplDestroyHelpWindow( true ); } } @@ -495,7 +495,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe sal_uInt16 nDelayMode = HELPDELAY_NORMAL; if ( pHelpWin ) { - DBG_ASSERT( pHelpWin != pParent, "HelpInHelp ?!" ); + SAL_WARN_IF( pHelpWin == pParent, "vcl", "HelpInHelp ?!" ); if ( ( ( pHelpWin->GetHelpText() != rHelpText ) || ( pHelpWin->GetWinStyle() != nHelpWinStyle ) @@ -539,7 +539,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe ) nDelayMode = HELPDELAY_NONE; - DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" ); + SAL_WARN_IF( pHelpWin, "vcl", "Noch ein HelpWin ?!" ); pHelpWin = VclPtr<HelpTextWindow>::Create( pParent, rHelpText, nHelpWinStyle, nStyle ); pSVData->maHelpData.mpHelpWin = pHelpWin; pHelpWin->SetStatusText( rStatusText ); diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index f3f7fa3a9c2e..8e99853fc3fe 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -127,7 +127,7 @@ void VCLSession::callSaveRequested( bool bShutdown ) m_bInteractionRequested = m_bInteractionGranted = !m_xSession; // answer the session manager even if no listeners available anymore - DBG_ASSERT( ! aListeners.empty(), "saveRequested but no listeners !" ); + SAL_WARN_IF( aListeners.empty(), "vcl", "saveRequested but no listeners !" ); if( aListeners.empty() ) { if (m_xSession) @@ -154,7 +154,7 @@ void VCLSession::callInteractionGranted( bool bInteractionGranted ) m_bInteractionGranted = bInteractionGranted; // answer the session manager even if no listeners available anymore - DBG_ASSERT( ! aListeners.empty(), "interactionGranted but no listeners !" ); + SAL_WARN_IF( aListeners.empty(), "vcl", "interactionGranted but no listeners !" ); if( aListeners.empty() ) { if (m_xSession) diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 7fc4d4cfbfc1..494e5415bf26 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -261,7 +261,7 @@ OUString Application::GetCommandLineParam( sal_uInt16 nParam ) OUString Application::GetAppFileName() { ImplSVData* pSVData = ImplGetSVData(); - DBG_ASSERT( pSVData->maAppData.mpAppFileName, "AppFileName should be set to something after SVMain!" ); + SAL_WARN_IF( !pSVData->maAppData.mpAppFileName, "vcl", "AppFileName should be set to something after SVMain!" ); if ( pSVData->maAppData.mpAppFileName ) return *pSVData->maAppData.mpAppFileName; @@ -1083,9 +1083,9 @@ void Application::RemoveUserEvent( ImplSVEvent * nUserEvent ) { if(nUserEvent) { - DBG_ASSERT( !nUserEvent->mpWindow, + SAL_WARN_IF( nUserEvent->mpWindow, "vcl", "Application::RemoveUserEvent(): Event is send to a window" ); - DBG_ASSERT( nUserEvent->mbCall, + SAL_WARN_IF( !nUserEvent->mbCall, "vcl", "Application::RemoveUserEvent(): Event is already removed" ); nUserEvent->mpWindow.clear(); @@ -1551,7 +1551,7 @@ UnoWrapperBase* Application::GetUnoWrapper( bool bCreateIfNotExist ) } aTkLib.release(); } - DBG_ASSERT( pSVData->mpUnoWrapper, "UnoWrapper could not be created!" ); + SAL_WARN_IF( !pSVData->mpUnoWrapper, "vcl", "UnoWrapper could not be created!" ); #else pSVData->mpUnoWrapper = CreateUnoWrapper(); #endif @@ -1563,7 +1563,7 @@ UnoWrapperBase* Application::GetUnoWrapper( bool bCreateIfNotExist ) void Application::SetUnoWrapper( UnoWrapperBase* pWrapper ) { ImplSVData* pSVData = ImplGetSVData(); - DBG_ASSERT( !pSVData->mpUnoWrapper, "SetUnoWrapper: Wrapper already exists" ); + SAL_WARN_IF( pSVData->mpUnoWrapper, "vcl", "SetUnoWrapper: Wrapper already exists" ); pSVData->mpUnoWrapper = pWrapper; } diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 2ebb805d2d1a..8ed72ec884ff 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -159,7 +159,7 @@ int ImplSVMain() // The 'real' SVMain() ImplSVData* pSVData = ImplGetSVData(); - DBG_ASSERT( pSVData->mpApp, "no instance of class Application" ); + SAL_WARN_IF( !pSVData->mpApp, "vcl", "no instance of class Application" ); int nReturn = EXIT_FAILURE; @@ -383,7 +383,7 @@ void DeInitVCL() aBuf.append( "\n" ); } } - DBG_ASSERT( nBadTopWindows==0, aBuf.getStr() ); + SAL_WARN_IF( nBadTopWindows!=0, "vcl", aBuf.getStr() ); #endif ImplImageTree::get().shutDown(); diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx index 0db903a57d3a..125a8add987c 100644 --- a/vcl/source/app/unohelp2.cxx +++ b/vcl/source/app/unohelp2.cxx @@ -41,7 +41,7 @@ namespace vcl { namespace unohelper { void TextDataObject::CopyStringTo( const OUString& rContent, const uno::Reference< datatransfer::clipboard::XClipboard >& rxClipboard ) { - DBG_ASSERT( rxClipboard.is(), "TextDataObject::CopyStringTo: invalid clipboard!" ); + SAL_WARN_IF( !rxClipboard.is(), "vcl", "TextDataObject::CopyStringTo: invalid clipboard!" ); if ( !rxClipboard.is() ) return; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 84d19f7ac71c..5399ae2e68bb 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2783,7 +2783,7 @@ static void LoadThemedImageList (const StyleSettings &rStyleSettings, aColorAry2[5] = rStyleSettings.GetWindowTextColor(); Color aMaskColor(0x00, 0x00, 0xFF ); - DBG_ASSERT( sizeof(aColorAry1) == sizeof(aColorAry2), "aColorAry1 must match aColorAry2" ); + SAL_WARN_IF( sizeof(aColorAry1) != sizeof(aColorAry2), "vcl", "aColorAry1 must match aColorAry2" ); // FIXME: do we want the mask for the checkbox ? pList->InsertFromHorizontalBitmap (rResId, nImages, &aMaskColor, aColorAry1, aColorAry2, sizeof(aColorAry1) / sizeof(Color)); @@ -3882,7 +3882,7 @@ void DisclosureButton::ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext) Image* pImg = nullptr; pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus; - DBG_ASSERT(pImg, "no disclosure image"); + SAL_WARN_IF(!pImg, "vcl", "no disclosure image"); if (!pImg) return; diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index b3716f0bc28e..2e0e32829f72 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1330,7 +1330,7 @@ void ComboBox::EnableUserDraw( bool bUserDraw ) void ComboBox::DrawEntry(const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos) { - DBG_ASSERT(rEvt.GetWindow() == m_pImpl->m_pImplLB->GetMainWindow(), "DrawEntry?!"); + SAL_WARN_IF(rEvt.GetWindow() != m_pImpl->m_pImplLB->GetMainWindow(), "vcl", "DrawEntry?!"); m_pImpl->m_pImplLB->GetMainWindow()->DrawEntry(*rEvt.GetRenderContext(), rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos); } diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 26cf163b946d..41e1336c65bb 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -109,7 +109,7 @@ void Control::FillLayoutData() const void Control::CreateLayoutData() const { - DBG_ASSERT( !mpControlData->mpLayoutData, "Control::CreateLayoutData: should be called with non-existent layout data only!" ); + SAL_WARN_IF( mpControlData->mpLayoutData, "vcl", "Control::CreateLayoutData: should be called with non-existent layout data only!" ); mpControlData->mpLayoutData = new vcl::ControlLayoutData(); } @@ -223,7 +223,7 @@ long ControlLayoutData::ToRelativeLineIndex( long nIndex ) const } if( nLine < 0 ) { - DBG_ASSERT( nLine >= 0, "ToRelativeLineIndex failed" ); + SAL_WARN_IF( nLine < 0, "vcl", "ToRelativeLineIndex failed" ); nIndex = -1; } } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index fdbb0aac5bee..4595309e8d93 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -836,7 +836,7 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool // take care of input-sequence-checking now if (bIsUserInput && !rStr.isEmpty()) { - DBG_ASSERT( rStr.getLength() == 1, "unexpected string length. User input is expected to provide 1 char only!" ); + SAL_WARN_IF( rStr.getLength() != 1, "vcl", "unexpected string length. User input is expected to provide 1 char only!" ); // determine if input-sequence-checking should be applied or not diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 1997cc1077e9..3b2c020f457e 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1244,8 +1244,8 @@ double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sa nDiv = aImplFactor[eInUnit][eOutUnit]; nMult = aImplFactor[eOutUnit][eInUnit]; - DBG_ASSERT( nMult > 0, "illegal *" ); - DBG_ASSERT( nDiv > 0, "illegal /" ); + SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" ); + SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" ); } if ( nMult != 1 && nMult > 0 ) @@ -1297,8 +1297,8 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, sal_Int64 nDiv = aImplFactor[eFieldUnit][eOutUnit]; sal_Int64 nMult = aImplFactor[eOutUnit][eFieldUnit]; - DBG_ASSERT( nMult > 0, "illegal *" ); - DBG_ASSERT( nDiv > 0, "illegal /" ); + SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" ); + SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" ); if ( nMult != 1 && nMult > 0) nValue *= nMult; @@ -1347,8 +1347,8 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits, sal_Int64 nDiv = aImplFactor[eInUnit][eFieldUnit]; sal_Int64 nMult = aImplFactor[eFieldUnit][eInUnit]; - DBG_ASSERT( nMult > 0, "illegal *" ); - DBG_ASSERT( nDiv > 0, "illegal /" ); + SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" ); + SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" ); if( nMult != 1 && nMult > 0 ) nValue *= nMult; diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 669078b185b9..d38f590a8dab 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -1615,7 +1615,7 @@ bool ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) ) ) { - DBG_ASSERT( !mpEntryList->IsEntryPosSelected( nSelect ) || mbMulti, "ImplListBox: Selecting same Entry" ); + SAL_WARN_IF( mpEntryList->IsEntryPosSelected( nSelect ) && !mbMulti, "vcl", "ImplListBox: Selecting same Entry" ); sal_Int32 nCount = mpEntryList->GetEntryCount(); if (nSelect >= nCount) nSelect = nCount ? nCount-1 : LISTBOX_ENTRY_NOTFOUND; diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 3492881871a8..9fbb4dc1263c 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -743,7 +743,7 @@ long ListBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) const else rPos = nEntry; - DBG_ASSERT( nIndex != -1, "found index for point, but relative index failed" ); + SAL_WARN_IF( nIndex == -1, "vcl", "found index for point, but relative index failed" ); } // Get line relative index diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index d58bd1955f9f..6eb44c527742 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -51,7 +51,7 @@ BigInt ImplPower10( sal_uInt16 n ) OUString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt &rNumber, sal_uInt16 nDigits, const OUString& rCurrSymbol, bool bShowThousandSep ) { - DBG_ASSERT( nDigits < 10, "LongCurrency may only have 9 decimal places" ); + SAL_WARN_IF( nDigits >= 10, "vcl", "LongCurrency may only have 9 decimal places" ); if ( rNumber.IsZero() || (long)rNumber ) return rLocaleDataWrapper.getCurr( (long)rNumber, nDigits, rCurrSymbol, bShowThousandSep ); diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 1fade35ae144..d0247fbb1c03 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -753,7 +753,7 @@ void SpinField::Resize() { if (maUpperRect.IsEmpty()) { - DBG_ASSERT( !maDropDownRect.IsEmpty(), "SpinField::Resize: SPIN && DROPDOWN, but all empty rects?" ); + SAL_WARN_IF( maDropDownRect.IsEmpty(), "vcl", "SpinField::Resize: SPIN && DROPDOWN, but all empty rects?" ); aSize.Width() = maDropDownRect.Left(); } else diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 88e4eb7c3c46..8b970309ff0c 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1624,8 +1624,8 @@ Size TabControl::GetTabPageSizePixel() const void TabControl::InsertPage( sal_uInt16 nPageId, const OUString& rText, sal_uInt16 nPos ) { - DBG_ASSERT( nPageId, "TabControl::InsertPage(): PageId == 0" ); - DBG_ASSERT( GetPagePos( nPageId ) == TAB_PAGE_NOTFOUND, + SAL_WARN_IF( !nPageId, "vcl", "TabControl::InsertPage(): PageId == 0" ); + SAL_WARN_IF( GetPagePos( nPageId ) != TAB_PAGE_NOTFOUND, "vcl", "TabControl::InsertPage(): PageId already exists" ); // insert new page item @@ -1889,7 +1889,7 @@ void TabControl::SetTabPage( sal_uInt16 nPageId, TabPage* pTabPage ) { if ( pTabPage ) { - DBG_ASSERT( !pTabPage->IsVisible() || isLayoutEnabled(pTabPage), + SAL_WARN_IF( pTabPage->IsVisible() && !isLayoutEnabled(pTabPage), "vcl", "TabControl::SetTabPage() - Non-Layout Enabled Page is visible" ); if ( IsDefaultSize() ) diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index 570d517b12d7..02897052dcbf 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -64,7 +64,7 @@ void TETextPortionList::Reset() void TETextPortionList::DeleteFromPortion( sal_uInt16 nDelFrom ) { - DBG_ASSERT( ( nDelFrom < size() ) || ( (nDelFrom == 0) && (size() == 0) ), "DeleteFromPortion: Out of range" ); + SAL_WARN_IF( ( nDelFrom >= size() ) && ( (nDelFrom != 0) || (size() != 0) ), "vcl", "DeleteFromPortion: Out of range" ); for ( iterator it = begin() + nDelFrom; it != end(); ++it ) delete *it; erase( begin() + nDelFrom, end() ); @@ -128,7 +128,7 @@ void TEParaPortion::MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff ) } else { - DBG_ASSERT( ( nDiff >= 0 ) || ( (nStart+nDiff) >= 0 ), "MarkInvalid: Diff out of Range" ); + SAL_WARN_IF( ( nDiff < 0 ) && ( (nStart+nDiff) < 0 ), "vcl", "MarkInvalid: Diff out of Range" ); mnInvalidPosStart = std::min( mnInvalidPosStart, nDiff < 0 ? nStart+nDiff : nDiff ); mnInvalidDiff = 0; mbSimple = false; @@ -181,7 +181,7 @@ sal_uInt16 TEParaPortion::GetLineNumber( sal_Int32 nChar, bool bInclEnd ) void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine ) { sal_uInt16 nLines = maLines.size(); - DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Leere Portion?" ); + SAL_WARN_IF( !nLines, "vcl", "CorrectPortionNumbersFromLine: Leere Portion?" ); if ( nLastFormattedLine < ( nLines - 1 ) ) { const TextLine& rLastFormatted = maLines[ nLastFormattedLine ]; diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index eceaeb8ea116..0e935a90b2f5 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -101,7 +101,7 @@ TextCharAttrib* TextCharAttribList::FindAttrib( sal_uInt16 nWhich, sal_Int32 nPo const TextCharAttrib* TextCharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos, sal_Int32 nMaxPos ) const { - DBG_ASSERT( nWhich, "FindNextAttrib: Which?" ); + SAL_WARN_IF( !nWhich, "vcl", "FindNextAttrib: Which?" ); for (std::vector<std::unique_ptr<TextCharAttrib> >::const_iterator it = maAttribs.begin(); it != maAttribs.end(); ++it) { if ( ( (*it)->GetStart() >= nFromPos ) && @@ -220,9 +220,9 @@ void TextNode::ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNew ) } } - DBG_ASSERT( rAttrib.GetStart() <= rAttrib.GetEnd(), "Expand: Attribut verdreht!" ); - DBG_ASSERT( ( rAttrib.GetEnd() <= maText.getLength() ), "Expand: Attrib groesser als Absatz!" ); - DBG_ASSERT( !rAttrib.IsEmpty(), "Leeres Attribut nach ExpandAttribs?" ); + SAL_WARN_IF( rAttrib.GetStart() > rAttrib.GetEnd(), "vcl", "Expand: Attribut verdreht!" ); + SAL_WARN_IF( ( rAttrib.GetEnd() > maText.getLength() ), "vcl", "Expand: Attrib groesser als Absatz!" ); + SAL_WARN_IF( rAttrib.IsEmpty(), "vcl", "Leeres Attribut nach ExpandAttribs?" ); } if ( bResort ) @@ -275,8 +275,8 @@ void TextNode::CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDeleted ) } } - DBG_ASSERT( rAttrib.GetStart() <= rAttrib.GetEnd(), "Collaps: Attribut verdreht!" ); - DBG_ASSERT( ( rAttrib.GetEnd() <= maText.getLength()) || bDelAttr, "Collaps: Attrib groesser als Absatz!" ); + SAL_WARN_IF( rAttrib.GetStart() > rAttrib.GetEnd(), "vcl", "Collaps: Attribut verdreht!" ); + SAL_WARN_IF( ( rAttrib.GetEnd() > maText.getLength()) && !bDelAttr, "vcl", "Collaps: Attrib groesser als Absatz!" ); if ( bDelAttr /* || rAttrib.IsEmpty() */ ) { bResort = true; @@ -352,8 +352,8 @@ TextNode* TextNode::Split( sal_Int32 nPos ) } else { - DBG_ASSERT( rAttrib.GetStart() >= nPos, "Start < nPos!" ); - DBG_ASSERT( rAttrib.GetEnd() >= nPos, "End < nPos!" ); + SAL_WARN_IF( rAttrib.GetStart() < nPos, "vcl", "Start < nPos!" ); + SAL_WARN_IF( rAttrib.GetEnd() < nPos, "vcl", "End < nPos!" ); // move all into the new node (this) maCharAttribs.RemoveAttrib( nAttr ); pNew->maCharAttribs.InsertAttrib( &rAttrib ); @@ -492,8 +492,8 @@ sal_Int32 TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSe TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c ) { - DBG_ASSERT( c != 0x0A, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); - DBG_ASSERT( c != 0x0D, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); + SAL_WARN_IF( c == 0x0A, "vcl", "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); + SAL_WARN_IF( c == 0x0D, "vcl", "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); TextNode* pNode = maTextNodes[ rPaM.GetPara() ]; pNode->InsertText( rPaM.GetIndex(), c ); @@ -504,8 +504,8 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c ) TextPaM TextDoc::InsertText( const TextPaM& rPaM, const OUString& rStr ) { - DBG_ASSERT( rStr.indexOf( 0x0A ) == -1, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); - DBG_ASSERT( rStr.indexOf( 0x0D ) == -1, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); + SAL_WARN_IF( rStr.indexOf( 0x0A ) != -1, "vcl", "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); + SAL_WARN_IF( rStr.indexOf( 0x0D ) != -1, "vcl", "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" ); TextNode* pNode = maTextNodes[ rPaM.GetPara() ]; pNode->InsertText( rPaM.GetIndex(), rStr ); @@ -519,7 +519,7 @@ TextPaM TextDoc::InsertParaBreak( const TextPaM& rPaM ) TextNode* pNode = maTextNodes[ rPaM.GetPara() ]; TextNode* pNew = pNode->Split( rPaM.GetIndex() ); - DBG_ASSERT( maTextNodes.size()<SAL_MAX_UINT32, "InsertParaBreak: more than 4Gi paragraphs!" ); + SAL_WARN_IF( maTextNodes.size()>=SAL_MAX_UINT32, "vcl", "InsertParaBreak: more than 4Gi paragraphs!" ); maTextNodes.insert( maTextNodes.begin() + rPaM.GetPara() + 1, pNew ); TextPaM aPaM( rPaM.GetPara()+1, 0 ); diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 73dc5f4edada..675d2dfb1ccb 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -464,7 +464,7 @@ void TextEngine::SetText( const OUString& rText ) FormatAndUpdate(); EnableUndo( bUndoCurrentlyEnabled ); - DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "SetText: Undo!" ); + SAL_WARN_IF( HasUndoManager() && GetUndoManager().GetUndoActionCount(), "vcl", "SetText: Undo!" ); } void TextEngine::CursorMoved( sal_uInt32 nNode ) @@ -477,7 +477,7 @@ void TextEngine::CursorMoved( sal_uInt32 nNode ) void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars ) { - DBG_ASSERT( nChars, "ImpRemoveChars: 0 Chars?!" ); + SAL_WARN_IF( !nChars, "vcl", "ImpRemoveChars: 0 Chars?!" ); if ( IsUndoEnabled() && !IsInUndo() ) { // attributes have to be saved for UNDO before RemoveChars! @@ -504,7 +504,7 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars ) TextPaM TextEngine::ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight ) { - DBG_ASSERT( nLeft != nRight, "ImpConnectParagraphs: connect the very same paragraph ?" ); + SAL_WARN_IF( nLeft == nRight, "vcl", "ImpConnectParagraphs: connect the very same paragraph ?" ); TextNode* pLeft = mpDoc->GetNodes()[ nLeft ]; TextNode* pRight = mpDoc->GetNodes()[ nRight ]; @@ -515,8 +515,8 @@ TextPaM TextEngine::ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight ) // first lookup Portions, as pRight is gone after ConnectParagraphs TEParaPortion* pLeftPortion = mpTEParaPortions->GetObject( nLeft ); TEParaPortion* pRightPortion = mpTEParaPortions->GetObject( nRight ); - DBG_ASSERT( pLeft && pLeftPortion, "ImpConnectParagraphs(1): Hidden Portion" ); - DBG_ASSERT( pRight && pRightPortion, "ImpConnectParagraphs(2): Hidden Portion" ); + SAL_WARN_IF( !pLeft || !pLeftPortion, "vcl", "ImpConnectParagraphs(1): Hidden Portion" ); + SAL_WARN_IF( !pRight || !pRightPortion, "vcl", "ImpConnectParagraphs(2): Hidden Portion" ); TextPaM aPaM = mpDoc->ConnectParagraphs( pLeft, pRight ); ImpParagraphRemoved( nRight ); @@ -543,8 +543,8 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) CursorMoved( aStartPaM.GetPara() ); // so that newly-adjusted attributes vanish CursorMoved( aEndPaM.GetPara() ); // so that newly-adjusted attributes vanish - DBG_ASSERT( mpDoc->IsValidPaM( aStartPaM ), "ImpDeleteText(1): bad Index" ); - DBG_ASSERT( mpDoc->IsValidPaM( aEndPaM ), "ImpDeleteText(2): bad Index" ); + SAL_WARN_IF( !mpDoc->IsValidPaM( aStartPaM ), "vcl", "ImpDeleteText(1): bad Index" ); + SAL_WARN_IF( !mpDoc->IsValidPaM( aEndPaM ), "vcl", "ImpDeleteText(2): bad Index" ); const sal_uInt32 nStartNode = aStartPaM.GetPara(); sal_uInt32 nEndNode = aEndPaM.GetPara(); @@ -565,7 +565,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) { ImpRemoveChars( aStartPaM, nChars ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( nStartNode ); - DBG_ASSERT( pPortion, "ImpDeleteText(3): bad Index" ); + SAL_WARN_IF( !pPortion, "vcl", "ImpDeleteText(3): bad Index" ); pPortion->MarkSelectionInvalid( aStartPaM.GetIndex(), pLeft->GetText().getLength() ); } @@ -578,7 +578,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) aEndPaM.GetIndex() = 0; ImpRemoveChars( aEndPaM, nChars ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( nEndNode ); - DBG_ASSERT( pPortion, "ImpDeleteText(4): bad Index" ); + SAL_WARN_IF( !pPortion, "vcl", "ImpDeleteText(4): bad Index" ); pPortion->MarkSelectionInvalid( 0, pPortion->GetNode()->GetText().getLength() ); } @@ -590,7 +590,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) const sal_Int32 nChars = aEndPaM.GetIndex() - aStartPaM.GetIndex(); ImpRemoveChars( aStartPaM, nChars ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( nStartNode ); - DBG_ASSERT( pPortion, "ImpDeleteText(5): bad Index" ); + SAL_WARN_IF( !pPortion, "vcl", "ImpDeleteText(5): bad Index" ); pPortion->MarkInvalid( aEndPaM.GetIndex(), aStartPaM.GetIndex() - aEndPaM.GetIndex() ); } @@ -654,8 +654,8 @@ TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, sal_Unicode c, TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, bool bOverwrite, bool bIsUserInput ) { - DBG_ASSERT( c != '\n', "InsertText: NewLine!" ); - DBG_ASSERT( c != '\r', "InsertText: NewLine!" ); + SAL_WARN_IF( c == '\n', "vcl", "InsertText: NewLine!" ); + SAL_WARN_IF( c == '\r', "vcl", "InsertText: NewLine!" ); TextPaM aPaM( rCurSel.GetStart() ); TextNode* pNode = mpDoc->GetNodes()[ aPaM.GetPara() ]; @@ -825,7 +825,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM ) TextPaM aPaM( mpDoc->InsertParaBreak( rPaM ) ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( rPaM.GetPara() ); - DBG_ASSERT( pPortion, "ImpInsertParaBreak: Hidden Portion" ); + SAL_WARN_IF( !pPortion, "vcl", "ImpInsertParaBreak: Hidden Portion" ); pPortion->MarkInvalid( rPaM.GetIndex(), 0 ); TextNode* pNewNode = mpDoc->GetNodes()[ aPaM.GetPara() ]; @@ -844,7 +844,7 @@ TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM ) Rectangle TextEngine::PaMtoEditCursor( const TextPaM& rPaM, bool bSpecial ) { - DBG_ASSERT( GetUpdateMode(), "PaMtoEditCursor: GetUpdateMode()" ); + SAL_WARN_IF( !GetUpdateMode(), "vcl", "PaMtoEditCursor: GetUpdateMode()" ); Rectangle aEditCursor; long nY = 0; @@ -901,7 +901,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP if ( !pLine ) { // Cursor at end of paragraph - DBG_ASSERT( rPaM.GetIndex() == nCurIndex, "GetEditCursor: Bad Index!" ); + SAL_WARN_IF( rPaM.GetIndex() != nCurIndex, "vcl", "GetEditCursor: Bad Index!" ); pLine = & ( pPortion->GetLines().back() ); nY -= mnCharHeight; @@ -921,7 +921,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart ) { - DBG_ASSERT( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "ImpGetXPos: Bad parameters!" ); + SAL_WARN_IF( ( nIndex < pLine->GetStart() ) || ( nIndex > pLine->GetEnd() ) , "vcl", "ImpGetXPos: Bad parameters!" ); bool bDoPreferPortionStart = bPreferPortionStart; // Assure that the portion belongs to this line @@ -935,7 +935,7 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex sal_Int32 nTextPortionStart = 0; size_t nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart ); - DBG_ASSERT( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line!" ); + SAL_WARN_IF( ( nTextPortion < pLine->GetStartPortion() ) || ( nTextPortion > pLine->GetEndPortion() ), "vcl", "GetXPos: Portion not in current line!" ); TETextPortion* pPortion = pParaPortion->GetTextPortions()[ nTextPortion ]; @@ -963,7 +963,7 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex { // nX += pNextPortion->GetWidth(); // End of the tab portion, use start of next for cursor pos - DBG_ASSERT( !bPreferPortionStart, "ImpGetXPos: How can we get here!" ); + SAL_WARN_IF( bPreferPortionStart, "vcl", "ImpGetXPos: How can we get here!" ); nX = ImpGetXPos( nPara, pLine, nIndex, true ); } @@ -972,7 +972,7 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex } else if ( pPortion->GetKind() == PORTIONKIND_TEXT ) { - DBG_ASSERT( nIndex != pLine->GetStart(), "ImpGetXPos: Strange behavior" ); + SAL_WARN_IF( nIndex == pLine->GetStart(), "vcl", "ImpGetXPos: Strange behavior" ); long nPosInPortion = CalcTextWidth( nPara, nTextPortionStart, nIndex-nTextPortionStart ); @@ -1031,7 +1031,7 @@ bool TextEngine::HasAttrib( sal_uInt16 nWhich ) const TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart ) { - DBG_ASSERT( GetUpdateMode(), "GetPaM: GetUpdateMode()" ); + SAL_WARN_IF( !GetUpdateMode(), "vcl", "GetPaM: GetUpdateMode()" ); long nY = 0; for ( sal_uInt32 nPortion = 0; nPortion < mpTEParaPortions->Count(); ++nPortion ) @@ -1059,7 +1059,7 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart ) sal_Int32 TextEngine::ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara, bool bSmart ) { - DBG_ASSERT( IsFormatted(), "GetPaM: Not formatted" ); + SAL_WARN_IF( !IsFormatted(), "vcl", "GetPaM: Not formatted" ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion ); sal_Int32 nCurIndex = 0; @@ -1133,7 +1133,7 @@ sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, sal_uInt16 nLine, long nX long TextEngine::GetTextHeight() const { - DBG_ASSERT( GetUpdateMode(), "GetTextHeight: GetUpdateMode()" ); + SAL_WARN_IF( !GetUpdateMode(), "vcl", "GetTextHeight: GetUpdateMode()" ); if ( !IsFormatted() && !IsFormatting() ) const_cast<TextEngine*>(this)->FormatAndUpdate(); @@ -1143,7 +1143,7 @@ long TextEngine::GetTextHeight() const long TextEngine::GetTextHeight( sal_uInt32 nParagraph ) const { - DBG_ASSERT( GetUpdateMode(), "GetTextHeight: GetUpdateMode()" ); + SAL_WARN_IF( !GetUpdateMode(), "vcl", "GetTextHeight: GetUpdateMode()" ); if ( !IsFormatted() && !IsFormatting() ) const_cast<TextEngine*>(this)->FormatAndUpdate(); @@ -1190,7 +1190,7 @@ long TextEngine::CalcTextWidth() long TextEngine::CalcTextHeight() { - DBG_ASSERT( GetUpdateMode(), "CalcTextHeight: GetUpdateMode()" ); + SAL_WARN_IF( !GetUpdateMode(), "vcl", "CalcTextHeight: GetUpdateMode()" ); long nY = 0; for ( auto nPortion = mpTEParaPortions->Count(); nPortion; ) @@ -1203,7 +1203,7 @@ long TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_I #ifdef DBG_UTIL // within the text there must not be a Portion change (attribute/tab)! sal_Int32 nTabPos = mpDoc->GetNodes()[ nPara ]->GetText().indexOf( '\t', nPortionStart ); - DBG_ASSERT( nTabPos == -1 || nTabPos >= (nPortionStart+nLen), "CalcTextWidth: Tab!" ); + SAL_WARN_IF( nTabPos != -1 && nTabPos < (nPortionStart+nLen), "vcl", "CalcTextWidth: Tab!" ); #endif long nWidth; @@ -1225,7 +1225,7 @@ long TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_I sal_uInt16 TextEngine::GetLineCount( sal_uInt32 nParagraph ) const { - DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" ); + SAL_WARN_IF( nParagraph >= mpTEParaPortions->Count(), "vcl", "GetLineCount: Out of range" ); TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph ); if ( pPPortion ) @@ -1236,7 +1236,7 @@ sal_uInt16 TextEngine::GetLineCount( sal_uInt32 nParagraph ) const sal_Int32 TextEngine::GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const { - DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" ); + SAL_WARN_IF( nParagraph >= mpTEParaPortions->Count(), "vcl", "GetLineCount: Out of range" ); TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph ); if ( pPPortion && ( nLine < pPPortion->GetLines().size() ) ) @@ -1252,7 +1252,7 @@ long TextEngine::CalcParaHeight( sal_uInt32 nParagraph ) const long nHeight = 0; TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph ); - DBG_ASSERT( pPPortion, "GetParaHeight: paragraph not found" ); + SAL_WARN_IF( !pPPortion, "vcl", "GetParaHeight: paragraph not found" ); if ( pPPortion ) nHeight = pPPortion->GetLines().size() * mnCharHeight; @@ -1326,7 +1326,7 @@ void TextEngine::UndoActionEnd() void TextEngine::InsertUndo( TextUndo* pUndo, bool bTryMerge ) { - DBG_ASSERT( !IsInUndo(), "InsertUndo: in Undo mode!" ); + SAL_WARN_IF( IsInUndo(), "vcl", "InsertUndo: in Undo mode!" ); GetUndoManager().AddUndoAction( pUndo, bTryMerge ); } @@ -1338,8 +1338,8 @@ void TextEngine::ResetUndo() void TextEngine::InsertContent( TextNode* pNode, sal_uInt32 nPara ) { - DBG_ASSERT( pNode, "InsertContent: NULL-Pointer!" ); - DBG_ASSERT( IsInUndo(), "InsertContent: only in Undo()!" ); + SAL_WARN_IF( !pNode, "vcl", "InsertContent: NULL-Pointer!" ); + SAL_WARN_IF( !IsInUndo(), "vcl", "InsertContent: only in Undo()!" ); TEParaPortion* pNew = new TEParaPortion( pNode ); mpTEParaPortions->Insert( pNew, nPara ); mpDoc->GetNodes().insert( mpDoc->GetNodes().begin() + nPara, pNode ); @@ -1350,9 +1350,9 @@ TextPaM TextEngine::SplitContent( sal_uInt32 nNode, sal_Int32 nSepPos ) { #ifdef DBG_UTIL TextNode* pNode = mpDoc->GetNodes()[ nNode ]; - DBG_ASSERT( pNode, "SplitContent: Invalid Node!" ); - DBG_ASSERT( IsInUndo(), "SplitContent: only in Undo()!" ); - DBG_ASSERT( nSepPos <= pNode->GetText().getLength(), "SplitContent: Bad index" ); + SAL_WARN_IF( !pNode, "vcl", "SplitContent: Invalid Node!" ); + SAL_WARN_IF( !IsInUndo(), "vcl", "SplitContent: only in Undo()!" ); + SAL_WARN_IF( nSepPos > pNode->GetText().getLength(), "vcl", "SplitContent: Bad index" ); #endif TextPaM aPaM( nNode, nSepPos ); return ImpInsertParaBreak( aPaM ); @@ -1360,7 +1360,7 @@ TextPaM TextEngine::SplitContent( sal_uInt32 nNode, sal_Int32 nSepPos ) TextPaM TextEngine::ConnectContents( sal_uInt32 nLeftNode ) { - DBG_ASSERT( IsInUndo(), "ConnectContent: only in Undo()!" ); + SAL_WARN_IF( !IsInUndo(), "vcl", "ConnectContent: only in Undo()!" ); return ImpConnectParagraphs( nLeftNode, nLeftNode+1 ); } @@ -1459,7 +1459,7 @@ void TextEngine::UpdateViews( TextView* pCurView ) if ( !GetUpdateMode() || IsFormatting() || maInvalidRect.IsEmpty() ) return; - DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" ); + SAL_WARN_IF( !IsFormatted(), "vcl", "UpdateViews: Doc not formatted!" ); for (TextView* pView : *mpViews) { @@ -1638,7 +1638,7 @@ void TextEngine::ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion* // Font still should be adjusted sal_Int32 nMaxBreakPos = mpRefDev->GetTextBreak( pNode->GetText(), nRemainingWidth, nPortionStart ); - DBG_ASSERT( nMaxBreakPos < pNode->GetText().getLength(), "ImpBreakLine: Break?!" ); + SAL_WARN_IF( nMaxBreakPos >= pNode->GetText().getLength(), "vcl", "ImpBreakLine: Break?!" ); if ( nMaxBreakPos == -1 ) // GetTextBreak() != GetTextSize() nMaxBreakPos = pNode->GetText().getLength() - 1; @@ -1674,7 +1674,7 @@ void TextEngine::ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion* // generally suppress blanks at the end of line TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); TETextPortion* pTP = pTEParaPortion->GetTextPortions()[ nEndPortion ]; - DBG_ASSERT( nBreakPos > pLine->GetStart(), "ImpBreakLine: SplitTextPortion at beginning of line?" ); + SAL_WARN_IF( nBreakPos <= pLine->GetStart(), "vcl", "ImpBreakLine: SplitTextPortion at beginning of line?" ); pTP->GetWidth() = CalcTextWidth( nPara, nBreakPos-pTP->GetLen(), pTP->GetLen()-1 ); } pLine->SetEndPortion( nEndPortion ); @@ -1705,7 +1705,7 @@ sal_uInt16 TextEngine::SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos ) } } - DBG_ASSERT( pTextPortion, "SplitTextPortion: position outside of region!" ); + SAL_WARN_IF( !pTextPortion, "vcl", "SplitTextPortion: position outside of region!" ); const sal_Int32 nOverlapp = nTmpPos - nPos; pTextPortion->GetLen() -= nOverlapp; @@ -1720,7 +1720,7 @@ void TextEngine::CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); TextNode* pNode = pTEParaPortion->GetNode(); - DBG_ASSERT( !pNode->GetText().isEmpty(), "CreateTextPortions: should not be used for empty paragraphs!" ); + SAL_WARN_IF( pNode->GetText().isEmpty(), "vcl", "CreateTextPortions: should not be used for empty paragraphs!" ); std::set<sal_Int32> aPositions; std::set<sal_Int32>::iterator aPositionsIt; @@ -1795,7 +1795,7 @@ void TextEngine::CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos ) aPositions.insert( nPortionStart ); aPositionsIt = aPositions.find( nPortionStart ); - DBG_ASSERT( aPositionsIt != aPositions.end(), "CreateTextPortions: nPortionStart not found" ); + SAL_WARN_IF( aPositionsIt == aPositions.end(), "vcl", "CreateTextPortions: nPortionStart not found" ); if ( aPositionsIt != aPositions.end() ) { @@ -1849,7 +1849,7 @@ void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_I sal_Int32 nPortionStart {0}; const sal_uInt16 nTP = pTEParaPortion->GetTextPortions().FindPortion( nStartPos, nPortionStart ); TETextPortion* const pTP = pTEParaPortion->GetTextPortions()[ nTP ]; - DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found!" ); + SAL_WARN_IF( !pTP, "vcl", "RecalcTextPortion: Portion not found!" ); pTP->GetLen() += nNewChars; pTP->GetWidth() = (-1); } @@ -1871,13 +1871,13 @@ void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_I pTP = pTEParaPortion->GetTextPortions()[ nPortion ]; if ( ( nPos+pTP->GetLen() ) > nStartPos ) { - DBG_ASSERT( nPos <= nStartPos, "RecalcTextPortion: Bad Start!" ); - DBG_ASSERT( nPos+pTP->GetLen() >= nEnd, "RecalcTextPortion: Bad End!" ); + SAL_WARN_IF( nPos > nStartPos, "vcl", "RecalcTextPortion: Bad Start!" ); + SAL_WARN_IF( nPos+pTP->GetLen() < nEnd, "vcl", "RecalcTextPortion: Bad End!" ); break; } nPos += pTP->GetLen(); } - DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found!" ); + SAL_WARN_IF( !pTP, "vcl", "RecalcTextPortion: Portion not found!" ); if ( ( nPos == nStartPos ) && ( (nPos+pTP->GetLen()) == nEnd ) ) { // remove Portion @@ -1886,7 +1886,7 @@ void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_I } else { - DBG_ASSERT( pTP->GetLen() > (-nNewChars), "RecalcTextPortion: Portion too small to shrink!" ); + SAL_WARN_IF( pTP->GetLen() <= (-nNewChars), "vcl", "RecalcTextPortion: Portion too small to shrink!" ); pTP->GetLen() += nNewChars; } OSL_ENSURE( pTEParaPortion->GetTextPortions().size(), @@ -1915,7 +1915,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan pSelStart = !bInvers ? &pSelection->GetStart() : &pSelection->GetEnd(); pSelEnd = bInvers ? &pSelection->GetStart() : &pSelection->GetEnd(); } - DBG_ASSERT( !pPaintRange || ( pPaintRange->GetStart() < pPaintRange->GetEnd() ), "ImpPaint: Paint-Range?!" ); + SAL_WARN_IF( !pPaintRange || ( pPaintRange->GetStart() < pPaintRange->GetEnd() ), "vcl", "ImpPaint: Paint-Range?!" ); const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings(); @@ -1949,7 +1949,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan OSL_ENSURE(pPortion->GetTextPortions().size(), "ImpPaint: Line without Textportion!"); TETextPortion* pTextPortion = pPortion->GetTextPortions()[ y ]; - DBG_ASSERT( pTextPortion, "ImpPaint: Bad pTextPortion!" ); + SAL_WARN_IF( !pTextPortion, "vcl", "ImpPaint: Bad pTextPortion!" ); ImpInitLayoutMode( pOutDev /*, pTextPortion->IsRightToLeft() */); @@ -2100,7 +2100,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara ) TextNode* pNode = mpDoc->GetNodes()[ nPara ]; TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); - DBG_ASSERT( pTEParaPortion->IsInvalid(), "CreateLines: Portion not invalid!" ); + SAL_WARN_IF( !pTEParaPortion->IsInvalid(), "vcl", "CreateLines: Portion not invalid!" ); const auto nOldLineCount = pTEParaPortion->GetLines().size(); @@ -2208,7 +2208,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara ) { nPortionStart = nTmpPos; pPortion = pTEParaPortion->GetTextPortions()[ nTmpPortion ]; - DBG_ASSERT( pPortion->GetLen(), "CreateLines: Empty Portion!" ); + SAL_WARN_IF( !pPortion->GetLen(), "vcl", "CreateLines: Empty Portion!" ); if ( pNode->GetText()[ nTmpPos ] == '\t' ) { long nCurPos = nTmpWidth-mpDoc->GetLeftMargin(); @@ -2278,7 +2278,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara ) } else if ( !bEOL ) { - DBG_ASSERT( (nPortionEnd-nPortionStart) == pPortion->GetLen(), "CreateLines: There is a Portion after all?!" ); + SAL_WARN_IF( (nPortionEnd-nPortionStart) != pPortion->GetLen(), "vcl", "CreateLines: There is a Portion after all?!" ); const long nRemainingWidth = mnMaxTextWidth - nTmpWidth; ImpBreakLine( nPara, pLine, pPortion, nPortionStart, nRemainingWidth ); } @@ -2395,7 +2395,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara ) pTEParaPortion->GetLines().end() ); } - DBG_ASSERT( pTEParaPortion->GetLines().size(), "CreateLines: No Line!" ); + SAL_WARN_IF( !pTEParaPortion->GetLines().size(), "vcl", "CreateLines: No Line!" ); pTEParaPortion->SetValid(); @@ -2808,7 +2808,7 @@ uno::Reference< i18n::XBreakIterator > TextEngine::GetBreakIterator() { if ( !mxBreakIterator.is() ) mxBreakIterator = vcl::unohelper::CreateBreakIterator(); - DBG_ASSERT( mxBreakIterator.is(), "BreakIterator: Failed to create!" ); + SAL_WARN_IF( !mxBreakIterator.is(), "vcl", "BreakIterator: Failed to create!" ); return mxBreakIterator; } diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx index 91237d356850..6cdd4442b421 100644 --- a/vcl/source/edit/textundo.cxx +++ b/vcl/source/edit/textundo.cxx @@ -101,7 +101,7 @@ bool TextUndoManager::Redo() void TextUndoManager::UndoRedoStart() { - DBG_ASSERT( GetView(), "Undo/Redo: Active View?" ); + SAL_WARN_IF( !GetView(), "vcl", "Undo/Redo: Active View?" ); } void TextUndoManager::UndoRedoEnd() diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index f62306fd960b..99f83fc0edf0 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -345,7 +345,7 @@ void TextView::ImpHighlight( const TextSelection& rSel ) { mpImpl->mpCursor->Hide(); - DBG_ASSERT( !mpImpl->mpTextEngine->mpIdleFormatter->IsActive(), "ImpHighlight: Not formatted!" ); + SAL_WARN_IF( mpImpl->mpTextEngine->mpIdleFormatter->IsActive(), "vcl", "ImpHighlight: Not formatted!" ); Rectangle aVisArea( mpImpl->maStartDocPos, mpImpl->mpWindow->GetOutputSizePixel() ); long nY = 0; @@ -859,7 +859,7 @@ void TextView::Command( const CommandEvent& rCEvt ) } else if ( rCEvt.GetCommand() == CommandEventId::EndExtTextInput ) { - DBG_ASSERT( mpImpl->mpTextEngine->mpIMEInfos, "CommandEventId::EndExtTextInput => No Start ?" ); + SAL_WARN_IF( !mpImpl->mpTextEngine->mpIMEInfos, "vcl", "CommandEventId::EndExtTextInput => No Start ?" ); if( mpImpl->mpTextEngine->mpIMEInfos ) { TEParaPortion* pPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( mpImpl->mpTextEngine->mpIMEInfos->aPos.GetPara() ); @@ -881,7 +881,7 @@ void TextView::Command( const CommandEvent& rCEvt ) } else if ( rCEvt.GetCommand() == CommandEventId::ExtTextInput ) { - DBG_ASSERT( mpImpl->mpTextEngine->mpIMEInfos, "CommandEventId::ExtTextInput => No Start ?" ); + SAL_WARN_IF( !mpImpl->mpTextEngine->mpIMEInfos, "vcl", "CommandEventId::ExtTextInput => No Start ?" ); if( mpImpl->mpTextEngine->mpIMEInfos ) { const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData(); @@ -912,7 +912,7 @@ void TextView::Command( const CommandEvent& rCEvt ) { // overwrite const sal_Int32 nOverwrite = std::min( nNewIMETextLen, mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.getLength() ) - nOldIMETextLen; - DBG_ASSERT( nOverwrite && (nOverwrite < 0xFF00), "IME Overwrite?!" ); + SAL_WARN_IF( !nOverwrite || (nOverwrite >= 0xFF00), "vcl", "IME Overwrite?!" ); TextPaM aPaM( mpImpl->mpTextEngine->mpIMEInfos->aPos ); aPaM.GetIndex() += nNewIMETextLen; TextSelection aSel( aPaM ); @@ -995,7 +995,7 @@ void TextView::HideCursor() void TextView::Scroll( long ndX, long ndY ) { - DBG_ASSERT( mpImpl->mpTextEngine->IsFormatted(), "Scroll: Not formatted!" ); + SAL_WARN_IF( !mpImpl->mpTextEngine->IsFormatted(), "vcl", "Scroll: Not formatted!" ); if ( !ndX && !ndY ) return; @@ -1901,7 +1901,7 @@ void TextView::dragGestureRecognized( const css::datatransfer::dnd::DragGestureE { SolarMutexGuard aVclGuard; - DBG_ASSERT( mpImpl->maSelection.HasRange(), "TextView::dragGestureRecognized: mpImpl->mbClickedInSelection, but no selection?" ); + SAL_WARN_IF( !mpImpl->maSelection.HasRange(), "vcl", "TextView::dragGestureRecognized: mpImpl->mbClickedInSelection, but no selection?" ); delete mpImpl->mpDDInfo; mpImpl->mpDDInfo = new TextDDInfo; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 14088b510eab..da9d79068042 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1268,7 +1268,7 @@ sal_uInt16 GraphicFilter::CanImportGraphic( const INetURLObject& rPath, sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat ) { sal_uInt16 nRetValue = GRFILTER_FORMATERROR; - DBG_ASSERT( rPath.GetProtocol() != INetProtocol::NotValid, "GraphicFilter::CanImportGraphic() : ProtType == INetProtocol::NotValid" ); + SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl", "GraphicFilter::CanImportGraphic() : ProtType == INetProtocol::NotValid" ); OUString aMainUrl( rPath.GetMainURL( INetURLObject::NO_DECODE ) ); std::unique_ptr<SvStream> xStream(::utl::UcbStreamHelper::CreateStream( aMainUrl, StreamMode::READ | StreamMode::SHARE_DENYNONE )); @@ -1298,7 +1298,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& sal_uInt16 nFormat, sal_uInt16 * pDeterminedFormat, GraphicFilterImportFlags nImportFlags ) { sal_uInt16 nRetValue = GRFILTER_FORMATERROR; - DBG_ASSERT( rPath.GetProtocol() != INetProtocol::NotValid, "GraphicFilter::ImportGraphic() : ProtType == INetProtocol::NotValid" ); + SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl", "GraphicFilter::ImportGraphic() : ProtType == INetProtocol::NotValid" ); OUString aMainUrl( rPath.GetMainURL( INetURLObject::NO_DECODE ) ); std::unique_ptr<SvStream> xStream(::utl::UcbStreamHelper::CreateStream( aMainUrl, StreamMode::READ | StreamMode::SHARE_DENYNONE )); @@ -1795,7 +1795,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLO #else SAL_INFO( "vcl.filter", "GraphicFilter::ExportGraphic() (thb)" ); sal_uInt16 nRetValue = GRFILTER_FORMATERROR; - DBG_ASSERT( rPath.GetProtocol() != INetProtocol::NotValid, "GraphicFilter::ExportGraphic() : ProtType == INetProtocol::NotValid" ); + SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl", "GraphicFilter::ExportGraphic() : ProtType == INetProtocol::NotValid" ); bool bAlreadyExists = DirEntryExists( rPath ); OUString aMainUrl( rPath.GetMainURL( INetURLObject::NO_DECODE ) ); diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index 8c352fa37f49..e71f14cb4937 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -176,7 +176,7 @@ void EMFWriter::ImplEndCommentRecord() void EMFWriter::ImplBeginPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags ) { - DBG_ASSERT( !mbRecordPlusOpen, "Another EMF+ record is already opened!" ); + SAL_WARN_IF( mbRecordPlusOpen, "vcl", "Another EMF+ record is already opened!" ); if( !mbRecordPlusOpen ) { @@ -190,7 +190,7 @@ void EMFWriter::ImplBeginPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags void EMFWriter::ImplEndPlusRecord() { - DBG_ASSERT( mbRecordPlusOpen, "EMF+ Record was not opened!" ); + SAL_WARN_IF( !mbRecordPlusOpen, "vcl", "EMF+ Record was not opened!" ); if( mbRecordPlusOpen ) { @@ -384,19 +384,19 @@ sal_uLong EMFWriter::ImplAcquireHandle() } } - DBG_ASSERT( nHandle != HANDLE_INVALID, "No more handles available" ); + SAL_WARN_IF( nHandle == HANDLE_INVALID, "vcl", "No more handles available" ); return( nHandle != HANDLE_INVALID ? nHandle + 1 : HANDLE_INVALID ); } void EMFWriter::ImplReleaseHandle( sal_uLong nHandle ) { - DBG_ASSERT( nHandle && ( nHandle < mHandlesUsed.size() ), "Handle out of range" ); + SAL_WARN_IF( !nHandle || ( nHandle >= mHandlesUsed.size() ), "vcl", "Handle out of range" ); mHandlesUsed[ nHandle - 1 ] = false; } void EMFWriter::ImplBeginRecord( sal_uInt32 nType ) { - DBG_ASSERT( !mbRecordOpen, "Another record is already opened!" ); + SAL_WARN_IF( mbRecordOpen, "vcl", "Another record is already opened!" ); if( !mbRecordOpen ) { @@ -410,7 +410,7 @@ void EMFWriter::ImplBeginRecord( sal_uInt32 nType ) void EMFWriter::ImplEndRecord() { - DBG_ASSERT( mbRecordOpen, "Record was not opened!" ); + SAL_WARN_IF( !mbRecordOpen, "vcl", "Record was not opened!" ); if( mbRecordOpen ) { diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index d7b7fe293b6d..c8f72a909d1c 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -1552,7 +1552,7 @@ bool EnhWMFReader::ReadEnhWMF() if ( nOptions & ETO_RTLREADING ) nTextLayoutMode = ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft; pOut->SetTextLayoutMode( nTextLayoutMode ); - DBG_ASSERT( ( nOptions & ( ETO_PDY | ETO_GLYPH_INDEX ) ) == 0, "SJ: ETO_PDY || ETO_GLYPH_INDEX in EMF" ); + SAL_WARN_IF( ( nOptions & ( ETO_PDY | ETO_GLYPH_INDEX ) ) != 0, "vcl", "SJ: ETO_PDY || ETO_GLYPH_INDEX in EMF" ); Point aPos( ptlReferenceX, ptlReferenceY ); bool bLenSane = nLen > 0 && nLen < static_cast<sal_Int32>( SAL_MAX_UINT32 / sizeof(sal_Int32) ); diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index 5c3ccd825d9e..6cc7ae99e17e 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -537,7 +537,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) if ( nOptions & ETO_RTLREADING ) nTextLayoutMode = ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft; pOut->SetTextLayoutMode( nTextLayoutMode ); - DBG_ASSERT( ( nOptions & ( ETO_PDY | ETO_GLYPH_INDEX ) ) == 0, "SJ: ETO_PDY || ETO_GLYPH_INDEX in WMF" ); + SAL_WARN_IF( ( nOptions & ( ETO_PDY | ETO_GLYPH_INDEX ) ) != 0, "vcl", "SJ: ETO_PDY || ETO_GLYPH_INDEX in WMF" ); // output only makes sense if the text contains characters if( nLen ) diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx index f0e0dbf9ff27..4991b6d0d389 100644 --- a/vcl/source/font/fontcache.cxx +++ b/vcl/source/font/fontcache.cxx @@ -137,7 +137,7 @@ LogicalFontInstance* ImplFontCache::GetFontInstance( PhysicalFontCollection* pFo { // find the best matching logical font family and update font selector accordingly pFontFamily = pFontList->FindFontFamily( aFontSelData ); - DBG_ASSERT( (pFontFamily != nullptr), "ImplFontCache::Get() No logical font found!" ); + SAL_WARN_IF( (pFontFamily == nullptr), "vcl", "ImplFontCache::Get() No logical font found!" ); if( pFontFamily ) aFontSelData.maSearchName = pFontFamily->GetSearchName(); diff --git a/vcl/source/fontsubset/fontsubset.cxx b/vcl/source/fontsubset/fontsubset.cxx index a1a147629a1c..4eca8a4be76f 100644 --- a/vcl/source/fontsubset/fontsubset.cxx +++ b/vcl/source/fontsubset/fontsubset.cxx @@ -51,7 +51,7 @@ bool FontSubsetInfo::LoadFont( FontSubsetInfo::FontType eInFontType, const unsigned char* pInFontBytes, int nInByteLength) { - DBG_ASSERT( (mpSftTTFont == nullptr), "Subset from SFT and from mapped font-file requested"); + SAL_WARN_IF( (mpSftTTFont != nullptr), "vcl", "Subset from SFT and from mapped font-file requested"); meInFontType = eInFontType; mpInFontBytes = pInFontBytes; mnInByteLength = nInByteLength; @@ -61,7 +61,7 @@ bool FontSubsetInfo::LoadFont( // prepare subsetting for fonts that are known to the SFT-parser bool FontSubsetInfo::LoadFont( vcl::TrueTypeFont* pSftTTFont ) { - DBG_ASSERT( (mpInFontBytes == nullptr), "Subset from SFT and from mapped font-file requested"); + SAL_WARN_IF( (mpInFontBytes != nullptr), "vcl", "Subset from SFT and from mapped font-file requested"); mpSftTTFont = pSftTTFont; meInFontType = ANY_SFNT; return (mpSftTTFont == nullptr); diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx index 6fc4cb7b6559..f78674be39d5 100644 --- a/vcl/source/fontsubset/xlat.cxx +++ b/vcl/source/fontsubset/xlat.cxx @@ -61,7 +61,7 @@ ConverterCache::~ConverterCache() void ConverterCache::ensureConverter( int nSelect ) { - // DBG_ASSERT( (2<=nSelect) && (nSelect<=MAX_CVT_SELECT)), "invalid XLAT.Converter requested" ); + // SAL_WARN_IF( (2>nSelect) || (nSelect>MAX_CVT_SELECT)), "vcl", "invalid XLAT.Converter requested" ); rtl_UnicodeToTextContext aContext = maContexts[ nSelect ]; if( !aContext ) { diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 133bb916399a..2f4fabf08ef9 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -486,13 +486,13 @@ bool Animation::Insert( const AnimationBitmap& rStepBmp ) const AnimationBitmap& Animation::Get( sal_uInt16 nAnimation ) const { - DBG_ASSERT( ( nAnimation < maList.size() ), "No object at this position" ); + SAL_WARN_IF( ( nAnimation >= maList.size() ), "vcl", "No object at this position" ); return *maList[ nAnimation ]; } void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 nAnimation ) { - DBG_ASSERT( ( nAnimation < maList.size() ), "No object at this position" ); + SAL_WARN_IF( ( nAnimation >= maList.size() ), "vcl", "No object at this position" ); delete maList[ nAnimation ]; maList[ nAnimation ] = new AnimationBitmap( rNewAnimationBitmap ); @@ -528,7 +528,7 @@ void Animation::ResetLoopCount() bool Animation::Convert( BmpConversion eConversion ) { - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); + SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" ); bool bRet; @@ -549,7 +549,7 @@ bool Animation::Convert( BmpConversion eConversion ) bool Animation::ReduceColors( sal_uInt16 nNewColorCount ) { - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); + SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" ); bool bRet; @@ -570,7 +570,7 @@ bool Animation::ReduceColors( sal_uInt16 nNewColorCount ) bool Animation::Invert() { - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); + SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" ); bool bRet; @@ -591,7 +591,7 @@ bool Animation::Invert() bool Animation::Mirror( BmpMirrorFlags nMirrorFlags ) { - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); + SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" ); bool bRet; @@ -627,7 +627,7 @@ bool Animation::Adjust( short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma, bool bInvert ) { - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); + SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" ); bool bRet; @@ -658,7 +658,7 @@ bool Animation::Adjust( short nLuminancePercent, short nContrastPercent, bool Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam ) { - DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" ); + SAL_WARN_IF( IsInAnimation(), "vcl", "Animation modified while it is animated" ); bool bRet; diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 9e5af0edb930..c5de58414969 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -493,7 +493,7 @@ bool Bitmap::ImplMakeMonoDither() bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys ) { - DBG_ASSERT( nGreys == 16 || nGreys == 256, "Only 16 or 256 greyscales are supported!" ); + SAL_WARN_IF( nGreys != 16 && nGreys != 256, "vcl", "Only 16 or 256 greyscales are supported!" ); BitmapReadAccess* pReadAcc = AcquireReadAccess(); bool bRet = false; @@ -605,7 +605,7 @@ bool Bitmap::ImplMakeGreyscales( sal_uInt16 nGreys ) bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color* pExtColor) { - DBG_ASSERT( nBitCount > GetBitCount(), "New BitCount must be greater!" ); + SAL_WARN_IF( nBitCount <= GetBitCount(), "vcl", "New BitCount must be greater!" ); Bitmap::ScopedReadAccess pReadAcc(*this); bool bRet = false; @@ -687,7 +687,7 @@ bool Bitmap::ImplConvertUp(sal_uInt16 nBitCount, Color* pExtColor) bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color* pExtColor) { - DBG_ASSERT(nBitCount <= GetBitCount(), "New BitCount must be lower ( or equal when pExtColor is set )!"); + SAL_WARN_IF(nBitCount > GetBitCount(), "vcl", "New BitCount must be lower ( or equal when pExtColor is set )!"); Bitmap::ScopedReadAccess pReadAcc(*this); bool bRet = false; diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 220c7167d60b..611c4208dbc3 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -179,7 +179,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const Color& rTransparentColor ) : { aMask = aBitmap.CreateMask( aTransparentColor ); - DBG_ASSERT( rBmp.GetSizePixel() == aMask.GetSizePixel(), + SAL_WARN_IF( rBmp.GetSizePixel() != aMask.GetSizePixel(), "vcl", "BitmapEx::BitmapEx(): size mismatch for bitmap and alpha mask." ); } @@ -380,7 +380,7 @@ bool BitmapEx::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag aBitmapSize = aBitmap.GetSizePixel(); - DBG_ASSERT( !aMask || aBitmap.GetSizePixel() == aMask.GetSizePixel(), + SAL_WARN_IF( !aMask || aBitmap.GetSizePixel() == aMask.GetSizePixel(), "vcl", "BitmapEx::Scale(): size mismatch for bitmap and alpha mask." ); } @@ -442,7 +442,7 @@ bool BitmapEx::Rotate( long nAngle10, const Color& rFillColor ) aBitmapSize = aBitmap.GetSizePixel(); - DBG_ASSERT( !aMask || aBitmap.GetSizePixel() == aMask.GetSizePixel(), + SAL_WARN_IF( !!aMask && aBitmap.GetSizePixel() != aMask.GetSizePixel(), "vcl", "BitmapEx::Rotate(): size mismatch for bitmap and alpha mask." ); } @@ -462,7 +462,7 @@ bool BitmapEx::Crop( const Rectangle& rRectPixel ) aBitmapSize = aBitmap.GetSizePixel(); - DBG_ASSERT( !aMask || aBitmap.GetSizePixel() == aMask.GetSizePixel(), + SAL_WARN_IF( !!aMask && aBitmap.GetSizePixel() != aMask.GetSizePixel(), "vcl", "BitmapEx::Crop(): size mismatch for bitmap and alpha mask." ); } @@ -495,7 +495,7 @@ bool BitmapEx::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor, bo aBitmapSize = aBitmap.GetSizePixel(); - DBG_ASSERT( !aMask || aBitmap.GetSizePixel() == aMask.GetSizePixel(), + SAL_WARN_IF( !!aMask && aBitmap.GetSizePixel() != aMask.GetSizePixel(), "vcl", "BitmapEx::Expand(): size mismatch for bitmap and alpha mask." ); } diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index 3bc0a55895b7..8357784ab757 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -50,7 +50,7 @@ void BitmapInfoAccess::ImplCreate( Bitmap& rBitmap ) { std::shared_ptr<ImpBitmap> xImpBmp = rBitmap.ImplGetImpBitmap(); - DBG_ASSERT( xImpBmp, "Forbidden Access to empty bitmap!" ); + SAL_WARN_IF( !xImpBmp, "vcl", "Forbidden Access to empty bitmap!" ); if( xImpBmp ) { @@ -404,8 +404,8 @@ BitmapWriteAccess::~BitmapWriteAccess() void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc ) { assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!"); - DBG_ASSERT( nY < rReadAcc.Height(), "y-coordinate in source out of range!" ); - DBG_ASSERT( ( HasPalette() && rReadAcc.HasPalette() ) || ( !HasPalette() && !rReadAcc.HasPalette() ), "No copying possible between palette bitmap and TC bitmap!" ); + SAL_WARN_IF( nY >= rReadAcc.Height(), "vcl", "y-coordinate in source out of range!" ); + SAL_WARN_IF( ( !HasPalette() || !rReadAcc.HasPalette() ) && ( HasPalette() || rReadAcc.HasPalette() ), "vcl", "No copying possible between palette bitmap and TC bitmap!" ); if( ( GetScanlineFormat() == rReadAcc.GetScanlineFormat() ) && ( GetScanlineSize() >= rReadAcc.GetScanlineSize() ) ) @@ -481,7 +481,7 @@ void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline, void BitmapWriteAccess::CopyBuffer( const BitmapReadAccess& rReadAcc ) { - DBG_ASSERT( ( HasPalette() && rReadAcc.HasPalette() ) || ( !HasPalette() && !rReadAcc.HasPalette() ), "No copying possible between palette bitmap and TC bitmap!" ); + SAL_WARN_IF( ( !HasPalette() || !rReadAcc.HasPalette() ) && ( HasPalette() || rReadAcc.HasPalette() ), "vcl", "No copying possible between palette bitmap and TC bitmap!" ); if( ( GetScanlineFormat() == rReadAcc.GetScanlineFormat() ) && ( GetScanlineSize() == rReadAcc.GetScanlineSize() ) ) diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index 6dd2c96a0431..6baf993b0ef4 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -348,7 +348,7 @@ bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer ) { // help the compiler to avoid instantiations of unneeded conversions - DBG_ASSERT( SRCFMT != DSTFMT, "ImplConvertToBitmap into same format"); + SAL_WARN_IF( SRCFMT == DSTFMT, "vcl", "ImplConvertToBitmap into same format"); if( SRCFMT == DSTFMT ) return false; @@ -543,7 +543,7 @@ bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine, BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer, const BitmapBuffer& rMskBuffer ) { - DBG_ASSERT( rMskBuffer.mnFormat == ScanlineFormat::N8BitPal, "FastBmp BlendImage: unusual MSKFMT" ); + SAL_WARN_IF( rMskBuffer.mnFormat != ScanlineFormat::N8BitPal, "vcl", "FastBmp BlendImage: unusual MSKFMT" ); const int nSrcLinestep = rSrcBuffer.mnScanlineSize; int nMskLinestep = rMskBuffer.mnScanlineSize; diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index 30e74541c1bf..39ff4e21deb3 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -37,7 +37,7 @@ GfxLink::GfxLink() GfxLink::GfxLink( std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nSize, GfxLinkType nType ) { - DBG_ASSERT( pBuf != nullptr && nSize, + SAL_WARN_IF( pBuf == nullptr || !nSize, "vcl", "GfxLink::GfxLink(): empty/NULL buffer given" ); meType = nType; diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index dc70e05f66ff..d8edab2617de 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -172,13 +172,13 @@ void ImplPointArray::ImplSetSize( sal_uLong nSize ) inline Point& ImplPointArray::operator[]( sal_uLong nPos ) { - DBG_ASSERT( nPos < mnSize, "ImplPointArray::operator[]: nPos out of range!" ); + SAL_WARN_IF( nPos >= mnSize, "vcl", "ImplPointArray::operator[]: nPos out of range!" ); return mpArray[ nPos ]; } inline const Point& ImplPointArray::operator[]( sal_uLong nPos ) const { - DBG_ASSERT( nPos < mnSize, "ImplPointArray::operator[]: nPos out of range!" ); + SAL_WARN_IF( nPos >= mnSize, "vcl", "ImplPointArray::operator[]: nPos out of range!" ); return mpArray[ nPos ]; } diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index 00362bb9740e..2b795e51aa99 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -128,7 +128,7 @@ JobSetup::JobSetup() JobSetup::JobSetup( const JobSetup& rJobSetup ) { - DBG_ASSERT( !rJobSetup.mpData || (rJobSetup.mpData->mnRefCount < 0xFFFE), "JobSetup: RefCount overflow" ); + SAL_WARN_IF( rJobSetup.mpData && (rJobSetup.mpData->mnRefCount >= 0xFFFE), "vcl", "JobSetup: RefCount overflow" ); mpData = rJobSetup.mpData; if ( mpData ) @@ -165,7 +165,7 @@ OUString JobSetup::GetDriverName() const JobSetup& JobSetup::operator=( const JobSetup& rJobSetup ) { - DBG_ASSERT( !rJobSetup.mpData || (rJobSetup.mpData->mnRefCount) < 0xFFFE, "JobSetup: RefCount overflow" ); + SAL_WARN_IF( rJobSetup.mpData && (rJobSetup.mpData->mnRefCount) >= 0xFFFE, "vcl", "JobSetup: RefCount overflow" ); // Increment refcount first, so that we can assign to ourselves if ( rJobSetup.mpData ) @@ -297,7 +297,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) else pJobData->maValueMap[ aKey ] = aValue; } - DBG_ASSERT( rIStream.Tell() == nFirstPos+nRead, "corrupted job setup" ); + SAL_WARN_IF( rIStream.Tell() != nFirstPos+nRead, "vcl", "corrupted job setup" ); // ensure correct stream position rIStream.Seek(nFirstPos + nRead); } diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 2647047f8502..abd08d88f472 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -120,7 +120,7 @@ sal_Int32 GlobalSyncData::GetMappedId() else nLinkId = -1; - DBG_ASSERT( nLinkId >= 0, "unmapped id in GlobalSyncData" ); + SAL_WARN_IF( nLinkId < 0, "vcl", "unmapped id in GlobalSyncData" ); } return nLinkId; @@ -133,7 +133,7 @@ sal_Int32 GlobalSyncData::GetMappedStructId( sal_Int32 nStructId ) else nStructId = -1; - DBG_ASSERT( nStructId >= 0, "unmapped structure id in GlobalSyncData" ); + SAL_WARN_IF( nStructId < 0, "vcl", "unmapped structure id in GlobalSyncData" ); return nStructId; } @@ -313,7 +313,7 @@ struct PageSyncData void PageSyncData::PushAction( const OutputDevice& rOutDev, const PDFExtOutDevDataSync::Action eAct ) { GDIMetaFile* pMtf = rOutDev.GetConnectMetaFile(); - DBG_ASSERT( pMtf, "PageSyncData::PushAction -> no ConnectMetaFile !!!" ); + SAL_WARN_IF( !pMtf, "vcl", "PageSyncData::PushAction -> no ConnectMetaFile !!!" ); PDFExtOutDevDataSync aSync; aSync.eAct = eAct; @@ -387,7 +387,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc case PDFExtOutDevDataSync::CreateControl: { std::shared_ptr< PDFWriter::AnyWidget > pControl( mControls.front() ); - DBG_ASSERT( pControl.get(), "PageSyncData::PlaySyncPageAct: invalid widget!" ); + SAL_WARN_IF( !pControl.get(), "vcl", "PageSyncData::PlaySyncPageAct: invalid widget!" ); if ( pControl.get() ) rWriter.CreateControl( *pControl ); mControls.pop_front(); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index ff0bc1aded1f..f719e706393d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1454,7 +1454,7 @@ void PDFWriterImpl::PDFPage::appendPolygon( const tools::Polygon& rPoly, OString if( pFlagArray && pFlagArray[i] == POLY_CONTROL && nPoints-i > 2 ) { // bezier - DBG_ASSERT( pFlagArray[i+1] == POLY_CONTROL && pFlagArray[i+2] != POLY_CONTROL, "unexpected sequence of control points" ); + SAL_WARN_IF( pFlagArray[i+1] != POLY_CONTROL || pFlagArray[i+2] == POLY_CONTROL, "vcl", "unexpected sequence of control points" ); appendPoint( rPoly[i], rBuffer ); rBuffer.append( " " ); appendPoint( rPoly[i+1], rBuffer ); @@ -2341,7 +2341,7 @@ bool PDFWriterImpl::updateObject( sal_Int32 n ) sal_uInt64 nOffset = ~0U; osl::File::RC aError = m_aFile.getPos(nOffset); - DBG_ASSERT( aError == osl::File::E_None, "could not register object" ); + SAL_WARN_IF( aError != osl::File::E_None, "vcl", "could not register object" ); if (aError != osl::File::E_None) { m_aFile.close(); @@ -2801,7 +2801,7 @@ bool PDFWriterImpl::emitTilings() for( std::vector<TilingEmit>::iterator it = m_aTilings.begin(); it != m_aTilings.end(); ++it ) { - DBG_ASSERT( it->m_pTilingStream, "tiling without stream" ); + SAL_WARN_IF( !it->m_pTilingStream, "vcl", "tiling without stream" ); if( ! it->m_pTilingStream ) continue; @@ -3324,7 +3324,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical ( pFontData[ nIndex ] >= 'A' && pFontData[ nIndex ] <= 'F' ) ) nLength2++; } - DBG_ASSERT( !(nLength2 & 1), "uneven number of hex chars in binary pfa section" ); + SAL_WARN_IF( (nLength2 & 1), "vcl", "uneven number of hex chars in binary pfa section" ); nLength2 /= 2; } @@ -3914,8 +3914,8 @@ bool PDFWriterImpl::emitFonts() { sal_uInt8 nEnc = fit->second.getGlyphId(); - DBG_ASSERT( aGlyphIds[nEnc] == 0 && pEncoding[nEnc] == 0, "duplicate glyph" ); - DBG_ASSERT( nEnc <= lit->m_aMapping.size(), "invalid glyph encoding" ); + SAL_WARN_IF( aGlyphIds[nEnc] != 0 || pEncoding[nEnc] != 0, "vcl", "duplicate glyph" ); + SAL_WARN_IF( nEnc > lit->m_aMapping.size(), "vcl", "invalid glyph encoding" ); aGlyphIds[ nEnc ] = fit->first; pEncoding[ nEnc ] = nEnc; @@ -3995,7 +3995,7 @@ bool PDFWriterImpl::emitFonts() sal_uInt64 nBytesRead = 0; if ( osl::File::E_None != aFontFile.read(xBuffer.get(), nLength1, nBytesRead) ) return false; - DBG_ASSERT( nBytesRead==nLength1, "PDF-FontSubset read incomplete!" ); + SAL_WARN_IF( nBytesRead!=nLength1, "vcl", "PDF-FontSubset read incomplete!" ); if ( osl::File::E_None != aFontFile.setPos(osl_Pos_Absolut, 0) ) return false; // get the PFB-segment lengths ThreeInts aSegmentLengths = {0,0,0}; @@ -8002,7 +8002,7 @@ bool PDFWriterImpl::emitTrailer() aLine.append( '0' ); aLine.append( aOffset ); aLine.append( " 00000 n \n" ); - DBG_ASSERT( aLine.getLength() == 20, "invalid xref entry" ); + SAL_WARN_IF( aLine.getLength() != 20, "vcl", "invalid xref entry" ); CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); } @@ -8467,7 +8467,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs, enc_it = pEncoding->find( cChar ); if( enc_it != pEncoding->end() && enc_it->second > 0 ) { - DBG_ASSERT( (enc_it->second & 0xffffff00) == 0, "Invalid character code" ); + SAL_WARN_IF( (enc_it->second & 0xffffff00) != 0, "vcl", "Invalid character code" ); cChar = (sal_Ucs)enc_it->second; } else if( (enc_it == pEncoding->end() || enc_it->second == -1) && @@ -9957,7 +9957,7 @@ void PDFWriterImpl::drawPolyPolygon( const tools::PolyPolygon& rPolyPoly ) void PDFWriterImpl::drawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt32 nTransparentPercent ) { - DBG_ASSERT( nTransparentPercent <= 100, "invalid alpha value" ); + SAL_WARN_IF( nTransparentPercent > 100, "vcl", "invalid alpha value" ); nTransparentPercent = nTransparentPercent % 100; MARK( "drawTransparent" ); @@ -10117,7 +10117,7 @@ void PDFWriterImpl::beginTransparencyGroup() void PDFWriterImpl::endTransparencyGroup( const Rectangle& rBoundingBox, sal_uInt32 nTransparentPercent ) { - DBG_ASSERT( nTransparentPercent <= 100, "invalid alpha value" ); + SAL_WARN_IF( nTransparentPercent > 100, "vcl", "invalid alpha value" ); nTransparentPercent = nTransparentPercent % 100; if( m_aContext.Version >= PDFWriter::PDF_1_4 ) @@ -10482,7 +10482,7 @@ void PDFWriterImpl::drawPolyLine( const tools::Polygon& rPoly, const LineInfo& r void PDFWriterImpl::convertLineInfoToExtLineInfo( const LineInfo& rIn, PDFWriter::ExtLineInfo& rOut ) { - DBG_ASSERT( rIn.GetStyle() == LINE_DASH, "invalid conversion" ); + SAL_WARN_IF( rIn.GetStyle() != LINE_DASH, "vcl", "invalid conversion" ); rOut.m_fLineWidth = rIn.GetWidth(); rOut.m_fTransparency = 0.0; rOut.m_eCap = PDFWriter::capButt; @@ -11168,13 +11168,13 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { aBitmap = rObject.m_aBitmap.GetMask(); aBitmap.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); - DBG_ASSERT( aBitmap.GetBitCount() == 1, "mask conversion failed" ); + SAL_WARN_IF( aBitmap.GetBitCount() != 1, "vcl", "mask conversion failed" ); } else if( aBitmap.GetBitCount() != 8 ) { aBitmap = rObject.m_aBitmap.GetAlpha().GetBitmap(); aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); - DBG_ASSERT( aBitmap.GetBitCount() == 8, "alpha mask conversion failed" ); + SAL_WARN_IF( aBitmap.GetBitCount() != 8, "vcl", "alpha mask conversion failed" ); } } @@ -11239,7 +11239,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { // #i47395# 1 bit bitmaps occasionally have an inverted grey palette sal_Int32 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( Color( COL_BLACK ) ) ); - DBG_ASSERT( nBlackIndex == 0 || nBlackIndex == 1, "wrong black index" ); + SAL_WARN_IF( nBlackIndex != 0 && nBlackIndex != 1, "vcl", "wrong black index" ); if( nBlackIndex == 1 ) aLine.append( "/Decode[1 0]\n" ); } @@ -11295,7 +11295,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { aLine.append( "/ImageMask true\n" ); sal_Int32 nBlackIndex = pAccess->GetBestPaletteIndex( BitmapColor( Color( COL_BLACK ) ) ); - DBG_ASSERT( nBlackIndex == 0 || nBlackIndex == 1, "wrong black index" ); + SAL_WARN_IF( nBlackIndex != 0 && nBlackIndex != 1, "vcl", "wrong black index" ); if( nBlackIndex ) aLine.append( "/Decode[ 1 0 ]\n" ); else @@ -13259,7 +13259,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa rNewWidget.m_eType = PDFWriter::CheckBox; rNewWidget.m_nRadioGroup = rBtn.RadioGroup; - DBG_ASSERT( nRadioGroupWidget >= 0 && nRadioGroupWidget < (sal_Int32)m_aWidgets.size(), "no radio group parent" ); + SAL_WARN_IF( nRadioGroupWidget < 0 || nRadioGroupWidget >= (sal_Int32)m_aWidgets.size(), "vcl", "no radio group parent" ); PDFWidget& rRadioButton = m_aWidgets[nRadioGroupWidget]; rRadioButton.m_aKids.push_back( rNewWidget.m_nObject ); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 6b57e48a6cc1..23dd0f2aa54b 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -964,8 +964,8 @@ Printer::~Printer() void Printer::dispose() { - DBG_ASSERT( !IsPrinting(), "Printer::~Printer() - Job is printing" ); - DBG_ASSERT( !IsJobActive(), "Printer::~Printer() - Job is active" ); + SAL_WARN_IF( IsPrinting(), "vcl", "Printer::~Printer() - Job is printing" ); + SAL_WARN_IF( IsJobActive(), "vcl", "Printer::~Printer() - Job is active" ); delete mpPrinterOptions; mpPrinterOptions = nullptr; @@ -1650,7 +1650,7 @@ bool Printer::EndJob() if ( !IsJobActive() ) return bRet; - DBG_ASSERT( !mbInPrintPage, "Printer::EndJob() - StartPage() without EndPage() called" ); + SAL_WARN_IF( mbInPrintPage, "vcl", "Printer::EndJob() - StartPage() without EndPage() called" ); mbJobActive = false; diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index c2e589d2cce0..b2e6bac54682 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -1059,11 +1059,11 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // add aTotalComponents as a new entry to aCCList aCCList.push_back( aTotalComponents ); - DBG_ASSERT( !aTotalComponents.aComponentList.empty(), + SAL_WARN_IF( aTotalComponents.aComponentList.empty(), "vcl", "Printer::GetPreparedMetaFile empty component" ); - DBG_ASSERT( !aTotalComponents.aBounds.IsEmpty() || (aTotalComponents.aComponentList.size() == 1), + SAL_WARN_IF( aTotalComponents.aBounds.IsEmpty() && (aTotalComponents.aComponentList.size() != 1), "vcl", "Printer::GetPreparedMetaFile non-output generating actions must be solitary"); - DBG_ASSERT( !aTotalComponents.bIsFullyTransparent || (aTotalComponents.aComponentList.size() == 1), + SAL_WARN_IF( aTotalComponents.bIsFullyTransparent && (aTotalComponents.aComponentList.size() != 1), "vcl", "Printer::GetPreparedMetaFile fully transparent actions must be solitary"); } diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 8b17c70ff3e7..7b244caa51cd 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1465,7 +1465,7 @@ void PrinterController::setValue( const css::beans::PropertyValue& i_rPropertyVa void PrinterController::setUIOptions( const css::uno::Sequence< css::beans::PropertyValue >& i_rOptions ) { - DBG_ASSERT( mpImplData->maUIOptions.getLength() == 0, "setUIOptions called twice !" ); + SAL_WARN_IF( mpImplData->maUIOptions.getLength() != 0, "vcl", "setUIOptions called twice !" ); mpImplData->maUIOptions = i_rOptions; @@ -1911,7 +1911,7 @@ css::uno::Any PrinterOptionsHelper::setUIControlOpt(const css::uno::Sequence< OU for( sal_Int32 i = 0; i < nAddProps; i++ ) aCtrl[ nUsed++ ] = i_rControlOptions.maAddProps[i]; - DBG_ASSERT( nUsed == nElements, "nUsed != nElements, probable heap corruption" ); + SAL_WARN_IF( nUsed != nElements, "vcl", "nUsed != nElements, probable heap corruption" ); return css::uno::makeAny( aCtrl ); } diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 4961a17463bb..d59f5c81e922 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -115,7 +115,7 @@ ImplRegionBand::ImplRegionBand( ImplRegionBand::~ImplRegionBand() { - DBG_ASSERT( mpFirstBandPoint == nullptr, "ImplRegionBand::~ImplRegionBand -> pointlist not empty" ); + SAL_WARN_IF( mpFirstBandPoint != nullptr, "vcl", "ImplRegionBand::~ImplRegionBand -> pointlist not empty" ); // delete elements of the list ImplRegionBandSep* pSep = mpFirstSep; @@ -364,7 +364,7 @@ void ImplRegionBand::OptimizeBand() void ImplRegionBand::Union( long nXLeft, long nXRight ) { - DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Union(): nxLeft > nXRight" ); + SAL_WARN_IF( nXLeft > nXRight, "vcl", "ImplRegionBand::Union(): nxLeft > nXRight" ); // band empty? -> add element if ( !mpFirstSep ) @@ -436,7 +436,7 @@ void ImplRegionBand::Union( long nXLeft, long nXRight ) void ImplRegionBand::Intersect( long nXLeft, long nXRight ) { - DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Intersect(): nxLeft > nXRight" ); + SAL_WARN_IF( nXLeft > nXRight, "vcl", "ImplRegionBand::Intersect(): nxLeft > nXRight" ); // band has been touched mbTouched = true; @@ -481,7 +481,7 @@ void ImplRegionBand::Intersect( long nXLeft, long nXRight ) void ImplRegionBand::Exclude( long nXLeft, long nXRight ) { - DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Exclude(): nxLeft > nXRight" ); + SAL_WARN_IF( nXLeft > nXRight, "vcl", "ImplRegionBand::Exclude(): nxLeft > nXRight" ); // band has been touched mbTouched = true; @@ -559,7 +559,7 @@ void ImplRegionBand::Exclude( long nXLeft, long nXRight ) void ImplRegionBand::XOr( long nXLeft, long nXRight ) { - DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::XOr(): nxLeft > nXRight" ); + SAL_WARN_IF( nXLeft > nXRight, "vcl", "ImplRegionBand::XOr(): nxLeft > nXRight" ); // #i46602# Reworked rectangle Xor @@ -702,7 +702,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) else // if( nXLeft != nOldLeft && nXRight != nOldRight ) follows automatically { // #4,5,6,7 - DBG_ASSERT( nXLeft != nOldLeft && nXRight != nOldRight, + SAL_WARN_IF( nXLeft == nOldLeft || nXRight == nOldRight, "vcl", "ImplRegionBand::XOr(): Case 4,5,6,7 expected all coordinates to be not equal!" ); // The plain-jane check would look like this: @@ -752,7 +752,7 @@ void ImplRegionBand::XOr( long nXLeft, long nXRight ) // holds. Note that we need the nXLeft<=nOldRight here, as // the intersection part might be only one pixel (original // nXLeft==nXRight) - DBG_ASSERT( nOldLeft<nXLeft && nXLeft<=nOldRight && nOldRight<nXRight, + SAL_WARN_IF( nOldLeft==nXLeft || nXLeft>nOldRight || nOldRight>=nXRight, "vcl", "ImplRegionBand::XOr(): Case 4,5,6,7 expected coordinates to be ordered now!" ); pSep->mnXLeft = nOldLeft; @@ -823,7 +823,7 @@ long ImplRegionBand::GetXLeftBoundary() const long ImplRegionBand::GetXRightBoundary() const { - DBG_ASSERT( mpFirstSep != nullptr, "ImplRegionBand::XRightBoundary -> no separation in band!" ); + SAL_WARN_IF( mpFirstSep == nullptr, "vcl", "ImplRegionBand::XRightBoundary -> no separation in band!" ); // search last separation ImplRegionBandSep* pSep = mpFirstSep; diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx index 44663759e217..73e7d4a4ec28 100644 --- a/vcl/source/gdi/regionband.cxx +++ b/vcl/source/gdi/regionband.cxx @@ -523,7 +523,7 @@ void RegionBand::InsertLine(const Point& rStartPt, const Point& rEndPt, long nLi void RegionBand::InsertPoint(const Point &rPoint, long nLineID, bool bEndPoint, LineType eLineType) { - DBG_ASSERT( mpFirstBand != nullptr, "RegionBand::InsertPoint - no bands available!" ); + SAL_WARN_IF( mpFirstBand == nullptr, "vcl", "RegionBand::InsertPoint - no bands available!" ); if ( rPoint.Y() == mpLastCheckedBand->mnYTop ) { @@ -636,7 +636,7 @@ bool RegionBand::OptimizeBandList() pBand = mpFirstBand; while ( pBand ) { - DBG_ASSERT( pBand->mpFirstSep != nullptr, "Exiting RegionBand::OptimizeBandList(): empty band in region!" ); + SAL_WARN_IF( pBand->mpFirstSep == nullptr, "vcl", "Exiting RegionBand::OptimizeBandList(): empty band in region!" ); if ( pBand->mnYBottom < pBand->mnYTop ) OSL_ENSURE(false, "RegionBand::OptimizeBandList(): YBottomBoundary < YTopBoundary" ); @@ -867,8 +867,8 @@ bool RegionBand::InsertSingleBand(ImplRegionBand* pBand, long nYBandPosition) void RegionBand::Union(long nLeft, long nTop, long nRight, long nBottom) { - DBG_ASSERT( nLeft <= nRight, "RegionBand::Union() - nLeft > nRight" ); - DBG_ASSERT( nTop <= nBottom, "RegionBand::Union() - nTop > nBottom" ); + SAL_WARN_IF( nLeft > nRight, "vcl", "RegionBand::Union() - nLeft > nRight" ); + SAL_WARN_IF( nTop > nBottom, "vcl", "RegionBand::Union() - nTop > nBottom" ); // process union ImplRegionBand* pBand = mpFirstBand; @@ -963,8 +963,8 @@ void RegionBand::Union(const RegionBand& rSource) void RegionBand::Exclude(long nLeft, long nTop, long nRight, long nBottom) { - DBG_ASSERT( nLeft <= nRight, "RegionBand::Exclude() - nLeft > nRight" ); - DBG_ASSERT( nTop <= nBottom, "RegionBand::Exclude() - nTop > nBottom" ); + SAL_WARN_IF( nLeft > nRight, "vcl", "RegionBand::Exclude() - nLeft > nRight" ); + SAL_WARN_IF( nTop > nBottom, "vcl", "RegionBand::Exclude() - nTop > nBottom" ); // process exclude ImplRegionBand* pBand = mpFirstBand; @@ -1004,8 +1004,8 @@ void RegionBand::Exclude(long nLeft, long nTop, long nRight, long nBottom) void RegionBand::XOr(long nLeft, long nTop, long nRight, long nBottom) { - DBG_ASSERT( nLeft <= nRight, "RegionBand::Exclude() - nLeft > nRight" ); - DBG_ASSERT( nTop <= nBottom, "RegionBand::Exclude() - nTop > nBottom" ); + SAL_WARN_IF( nLeft > nRight, "vcl", "RegionBand::Exclude() - nLeft > nRight" ); + SAL_WARN_IF( nTop > nBottom, "vcl", "RegionBand::Exclude() - nTop > nBottom" ); // process xor ImplRegionBand* pBand = mpFirstBand; diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 7c13637fcbe3..3c9e6a0e38af 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -247,7 +247,7 @@ basegfx::B2DPoint SalGraphics::mirror( const basegfx::B2DPoint& i_rPoint, const else w = GetGraphicsWidth(); - DBG_ASSERT( w, "missing graphics width" ); + SAL_WARN_IF( !w, "vcl", "missing graphics width" ); basegfx::B2DPoint aRet( i_rPoint ); if( w ) @@ -273,7 +273,7 @@ basegfx::B2DPolygon SalGraphics::mirror( const basegfx::B2DPolygon& i_rPoly, con else w = GetGraphicsWidth(); - DBG_ASSERT( w, "missing graphics width" ); + SAL_WARN_IF( !w, "vcl", "missing graphics width" ); basegfx::B2DPolygon aRet; if( w ) @@ -303,7 +303,7 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP else w = GetGraphicsWidth(); - DBG_ASSERT( w, "missing graphics width" ); + SAL_WARN_IF( !w, "vcl", "missing graphics width" ); basegfx::B2DPolyPolygon aRet; if( w ) diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 1ec7a084bca1..2227def1b8e6 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -507,7 +507,7 @@ ImplLayoutArgs::ImplLayoutArgs(const OUString& rStr, // add a run after splitting it up to get rid of control chars void ImplLayoutArgs::AddRun( int nCharPos0, int nCharPos1, bool bRTL ) { - DBG_ASSERT( nCharPos0 <= nCharPos1, "ImplLayoutArgs::AddRun() nCharPos0>=nCharPos1" ); + SAL_WARN_IF( nCharPos0 > nCharPos1, "vcl", "ImplLayoutArgs::AddRun() nCharPos0>=nCharPos1" ); // remove control characters from runs by splitting them up if( !bRTL ) diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index ef8ad97ecdd3..f9b4486c0b48 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -530,7 +530,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) sal_Int32 nActBegin = rIStm.Tell(); rIStm.ReadInt32( nActionSize ); - DBG_ASSERT( ( nType <= 33 ) || ( nType >= 1024 ), "Unknown GDIMetaAction while converting!" ); + SAL_WARN_IF( ( nType > 33 ) && ( nType < 1024 ), "vcl", "Unknown GDIMetaAction while converting!" ); switch( nType ) { @@ -863,7 +863,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp); sal_uInt8 nTerminator = 0; rIStm.ReadUChar( nTerminator ); - DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" ); + SAL_WARN_IF( nTerminator != 0, "vcl", "expected string to be NULL terminated" ); OUString aStr(OStringToOUString(aByteStr, eActualCharSet)); if ( nUnicodeCommentActionNumber == i ) @@ -884,7 +884,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp); sal_uInt8 nTerminator = 0; rIStm.ReadUChar( nTerminator ); - DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" ); + SAL_WARN_IF( nTerminator != 0, "vcl", "expected string to be NULL terminated" ); OUString aStr(OStringToOUString(aByteStr, eActualCharSet)); @@ -943,7 +943,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp); sal_uInt8 nTerminator = 0; rIStm.ReadUChar( nTerminator ); - DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" ); + SAL_WARN_IF( nTerminator != 0, "vcl", "expected string to be NULL terminated" ); OUString aStr(OStringToOUString(aByteStr, eActualCharSet)); if ( nUnicodeCommentActionNumber == i ) diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx index 2733aa0d369e..36373454933c 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/vcl/source/helper/lazydelete.cxx @@ -70,7 +70,7 @@ void DeleteOnDeinitBase::addDeinitContainer( DeleteOnDeinitBase* i_pContainer ) { ImplSVData* pSVData = ImplGetSVData(); - DBG_ASSERT( ! pSVData->mbDeInit, "DeleteOnDeinit added after DeiInitVCL !" ); + SAL_WARN_IF( pSVData->mbDeInit, "vcl", "DeleteOnDeinit added after DeiInitVCL !" ); if( pSVData->mbDeInit ) return; diff --git a/vcl/source/image/ImageList.cxx b/vcl/source/image/ImageList.cxx index 1ba8768f22a2..aab0150649e5 100644 --- a/vcl/source/image/ImageList.cxx +++ b/vcl/source/image/ImageList.cxx @@ -238,7 +238,7 @@ sal_uInt16 ImageList::ImplGetImageId( const OUString& rImageName ) const void ImageList::AddImage( const OUString& rImageName, const Image& rImage ) { - DBG_ASSERT( GetImagePos( rImageName ) == IMAGELIST_IMAGE_NOTFOUND, "ImageList::AddImage() - ImageName already exists" ); + SAL_WARN_IF( GetImagePos( rImageName ) != IMAGELIST_IMAGE_NOTFOUND, "vcl", "ImageList::AddImage() - ImageName already exists" ); if( !mpImplData ) ImplInit( 0, rImage.GetSizePixel() ); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 388b9b566886..48e16525ad39 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1523,8 +1523,8 @@ sal_Int32 OutputDevice::HasGlyphs( const vcl::Font& rTempFont, const OUString& r else nEnd = std::min( rStr.getLength(), nIndex + nLen ); - DBG_ASSERT( nIndex < nEnd, "StartPos >= EndPos?" ); - DBG_ASSERT( nEnd <= rStr.getLength(), "String too short" ); + SAL_WARN_IF( nIndex >= nEnd, "vcl", "StartPos >= EndPos?" ); + SAL_WARN_IF( nEnd > rStr.getLength(), "vcl", "String too short" ); // to get the map temporarily set font const vcl::Font aOrigFont = GetFont(); diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index af4c2a82a6b2..871407dec5d3 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -1518,8 +1518,8 @@ static void verifyUnitSourceDest( MapUnit eUnitSource, MapUnit eUnitDest ) #define ENTER3( eUnitSource, eUnitDest ) \ long nNumerator = 1; \ long nDenominator = 1; \ - DBG_ASSERT( eUnitSource < s_ImplArySize, "Invalid source map unit"); \ - DBG_ASSERT( eUnitDest < s_ImplArySize, "Invalid destination map unit"); \ + SAL_WARN_IF( eUnitSource >= s_ImplArySize, "vcl", "Invalid source map unit"); \ + SAL_WARN_IF( eUnitDest >= s_ImplArySize, "vcl", "Invalid destination map unit"); \ if( (eUnitSource < s_ImplArySize) && (eUnitDest < s_ImplArySize) ) \ { \ nNumerator = aImplNumeratorAry[eUnitSource] * \ diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 4c32c66c3165..e8bd5f434823 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -634,7 +634,7 @@ void OutputDevice::drawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rP if ( !AcquireGraphics() ) return; } - DBG_ASSERT( mpGraphics && pSrcDev->mpGraphics, + SAL_WARN_IF( !mpGraphics || !pSrcDev->mpGraphics, "vcl", "OutputDevice::DrawOutDev(): We need more than one Graphics" ); } } diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx index ff9772aff3e3..478a693e068b 100644 --- a/vcl/source/outdev/pixel.cxx +++ b/vcl/source/outdev/pixel.cxx @@ -121,7 +121,7 @@ void OutputDevice::DrawPixel( const tools::Polygon& rPts, const Color* pColors ) } else { - DBG_ASSERT( pColors, "OutputDevice::DrawPixel: No color array specified" ); + SAL_WARN_IF( !pColors, "vcl", "OutputDevice::DrawPixel: No color array specified" ); const sal_uInt16 nSize = rPts.GetSize(); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 114b35b09a22..2de235bf5ceb 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -524,7 +524,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, { nSoftBreak = nPos; } - DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); + SAL_WARN_IF( nSoftBreak >= nBreakPos, "vcl", "Break?!" ); css::i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, css::uno::Sequence <css::beans::PropertyValue>(), 1 ); css::i18n::LineBreakUserOptions aUserOptions; css::i18n::LineBreakResults aLBR = xBI->getLineBreak( rStr, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions ); @@ -547,13 +547,13 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, css::i18n::Boundary aBoundary = xBI->getWordBoundary( rStr, nBreakPos, rDefLocale, css::i18n::WordType::DICTIONARY_WORD, true ); sal_Int32 nWordStart = nPos; sal_Int32 nWordEnd = aBoundary.endPos; - DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" ); + SAL_WARN_IF( nWordEnd <= nWordStart, "vcl", "ImpBreakLine: Start >= End?" ); sal_Int32 nWordLen = nWordEnd - nWordStart; if ( ( nWordEnd >= nSoftBreak ) && ( nWordLen > 3 ) ) { // #104415# May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD - // DBG_ASSERT( nWordEnd >= nMaxBreakPos, "Hyph: Break?" ); + // SAL_WARN_IF( nWordEnd < nMaxBreakPos, "vcl", "Hyph: Break?" ); OUString aWord = rStr.copy( nWordStart, nWordLen ); sal_Int32 nMinTrail = nWordEnd-nSoftBreak+1; //+1: Before the "broken off" char css::uno::Reference< css::linguistic2::XHyphenatedWord > xHyphWord; @@ -611,7 +611,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ++nTxtEnd; } - DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Wrong assumption!" ); + SAL_WARN_IF( ( nAltEnd - nAltStart ) != 1, "vcl", "Alternate: Wrong assumption!" ); if ( nTxtEnd > nTxtStart ) cAlternateReplChar = aAlt[ nAltStart ]; @@ -676,8 +676,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, { ImplTextLineInfo* pLine = rLineInfo.GetLine( nL ); OUString aLine = rStr.copy( pLine->GetIndex(), pLine->GetLen() ); - DBG_ASSERT( aLine.indexOf( '\r' ) == -1, "ImplGetTextLines - Found CR!" ); - DBG_ASSERT( aLine.indexOf( '\n' ) == -1, "ImplGetTextLines - Found LF!" ); + SAL_WARN_IF( aLine.indexOf( '\r' ) != -1, "vcl", "ImplGetTextLines - Found CR!" ); + SAL_WARN_IF( aLine.indexOf( '\n' ) != -1, "vcl", "ImplGetTextLines - Found LF!" ); } #endif @@ -2186,7 +2186,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, { if( nMnemonicPos < (nIndex+nLen) ) --nLen; - DBG_ASSERT( nMnemonicPos < (nIndex+nLen), "Mnemonic underline marker after last character" ); + SAL_WARN_IF( nMnemonicPos >= (nIndex+nLen), "vcl", "Mnemonic underline marker after last character" ); } bool bInvalidPos = false; diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx index bf72b66c1d8e..57c1da27cb64 100644 --- a/vcl/source/window/accel.cxx +++ b/vcl/source/window/accel.cxx @@ -176,7 +176,7 @@ void Accelerator::ImplDeleteData() void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode, bool bEnable, Accelerator* pAutoAccel ) { - DBG_ASSERT( nItemId, "Accelerator::InsertItem(): ItemId == 0" ); + SAL_WARN_IF( !nItemId, "vcl", "Accelerator::InsertItem(): ItemId == 0" ); if ( rKeyCode.IsFunction() ) { diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index f4b6a24b99d6..2b42c13e27b7 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -269,7 +269,7 @@ vcl::Window* Window::GetAccessibleChildWindow( sal_uInt16 n ) if( GetType() == WINDOW_BORDERWINDOW && pChild && pChild->GetType() == WINDOW_MENUBARWINDOW ) { do pChild = pChild->mpWindowImpl->mpNext; while( pChild && ! pChild->IsVisible() ); - DBG_ASSERT( pChild, "GetAccessibleChildWindow(): wrong index in border window"); + SAL_WARN_IF( !pChild, "vcl", "GetAccessibleChildWindow(): wrong index in border window"); } if ( pChild && ( pChild->GetType() == WINDOW_BORDERWINDOW ) && ( pChild->GetChildCount() == 1 ) ) @@ -284,7 +284,7 @@ void Window::SetAccessibleRole( sal_uInt16 nRole ) if ( !mpWindowImpl->mpAccessibleInfos ) mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; - DBG_ASSERT( mpWindowImpl->mpAccessibleInfos->nAccessibleRole == 0xFFFF, "AccessibleRole already set!" ); + SAL_WARN_IF( mpWindowImpl->mpAccessibleInfos->nAccessibleRole != 0xFFFF, "vcl", "AccessibleRole already set!" ); mpWindowImpl->mpAccessibleInfos->nAccessibleRole = nRole; } @@ -516,7 +516,7 @@ void Window::SetAccessibleDescription( const OUString& rDescription ) if ( ! mpWindowImpl->mpAccessibleInfos ) mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; - DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleDescription, "AccessibleDescription already set!" ); + SAL_WARN_IF( mpWindowImpl->mpAccessibleInfos->pAccessibleDescription, "vcl", "AccessibleDescription already set!" ); delete mpWindowImpl->mpAccessibleInfos->pAccessibleDescription; mpWindowImpl->mpAccessibleInfos->pAccessibleDescription = new OUString( rDescription ); } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index f8f67342b78d..0946b0d7fe79 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -820,11 +820,11 @@ bool Dialog::ImplStartExecuteModal() if ( pParent ) { pParent = pParent->ImplGetFirstOverlapWindow(); - DBG_ASSERT( pParent->IsReallyVisible(), + SAL_WARN_IF( !pParent->IsReallyVisible(), "vcl", "Dialog::StartExecuteModal() - Parent not visible" ); - DBG_ASSERT( pParent->IsInputEnabled(), + SAL_WARN_IF( !pParent->IsInputEnabled(), "vcl", "Dialog::StartExecuteModal() - Parent input disabled, use another parent to ensure modality!" ); - DBG_ASSERT( ! pParent->IsInModalMode(), + SAL_WARN_IF( pParent->IsInModalMode(), "vcl", "Dialog::StartExecuteModal() - Parent already modally disabled, use another parent to ensure modality!" ); } diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 2dbda7fdfb32..6e5b18a84995 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -186,7 +186,7 @@ vcl::Window* Window::ImplGetDlgWindow( sal_uInt16 nIndex, GetDlgWindowType nType sal_uInt16 nFormStart, sal_uInt16 nFormEnd, sal_uInt16* pIndex ) { - DBG_ASSERT( (nIndex >= nFormStart) && (nIndex <= nFormEnd), + SAL_WARN_IF( (nIndex < nFormStart) || (nIndex > nFormEnd), "vcl", "Window::ImplGetDlgWindow() - nIndex not in Form" ); vcl::Window* pWindow = nullptr; @@ -383,7 +383,7 @@ vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pParent, vcl::Window* pWindow, vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_Unicode cCharCode, sal_uInt16 nFormStart, sal_uInt16 nFormEnd, bool bCheckEnable ) { - DBG_ASSERT( (rIndex >= nFormStart) && (rIndex <= nFormEnd), + SAL_WARN_IF( (rIndex < nFormStart) || (rIndex > nFormEnd), "vcl", "Window::ImplFindAccelWindow() - rIndex not in Form" ); sal_Unicode cCompareChar; diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 1b8ef138bc6a..107450a434d6 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -110,7 +110,7 @@ void ImplDockFloatWin2::dispose() IMPL_LINK_NOARG_TYPED(ImplDockFloatWin2, DockTimerHdl, Idle *, void) { - DBG_ASSERT( mpDockWin->IsFloatingMode(), "docktimer called but not floating" ); + SAL_WARN_IF( !mpDockWin->IsFloatingMode(), "vcl", "docktimer called but not floating" ); maDockIdle.Stop(); PointerState aState = GetPointerState(); @@ -136,7 +136,7 @@ IMPL_LINK_NOARG_TYPED(ImplDockFloatWin2, DockTimerHdl, Idle *, void) IMPL_LINK_NOARG_TYPED(ImplDockFloatWin2, EndDockTimerHdl, Idle *, void) { - DBG_ASSERT( mpDockWin->IsFloatingMode(), "enddocktimer called but not floating" ); + SAL_WARN_IF( !mpDockWin->IsFloatingMode(), "vcl", "enddocktimer called but not floating" ); maEndDockIdle.Stop(); PointerState aState = GetPointerState(); diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index a42bca14c5a0..236844686a1b 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -128,7 +128,7 @@ void ImplDockFloatWin::dispose() IMPL_LINK_NOARG_TYPED(ImplDockFloatWin, DockTimerHdl, Idle *, void) { - DBG_ASSERT( mpDockWin->IsFloatingMode(), "docktimer called but not floating" ); + SAL_WARN_IF( !mpDockWin->IsFloatingMode(), "vcl", "docktimer called but not floating" ); maDockIdle.Stop(); PointerState aState = GetPointerState(); diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx index aa09c101068c..050b07948f34 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -343,9 +343,9 @@ ImplSVEvent * Window::PostUserEvent( const Link<void*,void>& rLink, void* pCalle void Window::RemoveUserEvent( ImplSVEvent * nUserEvent ) { - DBG_ASSERT( nUserEvent->mpWindow.get() == this, + SAL_WARN_IF( nUserEvent->mpWindow.get() != this, "vcl", "Window::RemoveUserEvent(): Event doesn't send to this window or is already removed" ); - DBG_ASSERT( nUserEvent->mbCall, + SAL_WARN_IF( !nUserEvent->mbCall, "vcl", "Window::RemoveUserEvent(): Event is already removed" ); if ( nUserEvent->mpWindow ) diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 20b1579b0ad3..2362f13cdf2f 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -65,12 +65,12 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle ) mbInCleanUp = false; mbGrabFocus = false; - DBG_ASSERT(pParent, "FloatWindow::FloatingWindow(): - pParent == NULL!"); + SAL_WARN_IF(!pParent, "vcl", "FloatWindow::FloatingWindow(): - pParent == NULL!"); if (!pParent) pParent = ImplGetSVData()->maWinData.mpAppWin; - DBG_ASSERT(pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists"); + SAL_WARN_IF(!pParent, "vcl", "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists"); // no Border, then we don't need a border window if (!nStyle) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ae832f256a29..f40a5b4e90df 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -383,8 +383,8 @@ MenuItemData* Menu::NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits, void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nItemBits, const OString &rIdent, sal_uInt16 nPos) { - DBG_ASSERT( nItemId, "Menu::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( nItemId ) == MENU_ITEM_NOTFOUND, + SAL_WARN_IF( !nItemId, "vcl", "Menu::InsertItem(): ItemId == 0" ); + SAL_WARN_IF( GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND, "vcl", "Menu::InsertItem(): ItemId already exists" ); // if Position > ItemCount, append @@ -597,7 +597,7 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 n { sal_uInt16 nId = rMenu.GetItemId( nPos ); - DBG_ASSERT( pThis->GetItemPos( nId ) == MENU_ITEM_NOTFOUND, + SAL_WARN_IF( pThis->GetItemPos( nId ) != MENU_ITEM_NOTFOUND, "vcl", "Menu::CopyItem(): ItemId already exists" ); MenuItemData* pData = rMenu.GetItemList()->GetData( nId ); @@ -965,7 +965,7 @@ void Menu::EnableItem( sal_uInt16 nItemId, bool bEnable ) vcl::Window* pWin = ImplGetWindow(); if ( pWin && pWin->IsVisible() ) { - DBG_ASSERT(IsMenuBar(), "Menu::EnableItem - Popup visible!" ); + SAL_WARN_IF(!IsMenuBar(), "vcl", "Menu::EnableItem - Popup visible!" ); long nX = 0; size_t nCount = pItemList->size(); for ( size_t n = 0; n < nCount; n++ ) @@ -1003,7 +1003,7 @@ void Menu::ShowItem( sal_uInt16 nItemId, bool bVisible ) size_t nPos; MenuItemData* pData = pItemList->GetData( nItemId, nPos ); - DBG_ASSERT(!IsMenuBar(), "Menu::ShowItem - ignored for menu bar entries!"); + SAL_WARN_IF(IsMenuBar(), "vcl", "Menu::ShowItem - ignored for menu bar entries!"); if (!IsMenuBar()&& pData && (pData->bVisible != bVisible)) { vcl::Window* pWin = ImplGetWindow(); @@ -1413,7 +1413,7 @@ bool Menu::ImplGetNativeSubmenuArrowSize(vcl::RenderContext& rRenderContext, Siz void Menu::ImplAddDel( ImplMenuDelData& rDel ) { - DBG_ASSERT( !rDel.mpMenu, "Menu::ImplAddDel(): cannot add ImplMenuDelData twice !" ); + SAL_WARN_IF( rDel.mpMenu, "vcl", "Menu::ImplAddDel(): cannot add ImplMenuDelData twice !" ); if( !rDel.mpMenu ) { rDel.mpMenu = this; @@ -1435,7 +1435,7 @@ void Menu::ImplRemoveDel( ImplMenuDelData& rDel ) while ( pData && (pData->mpNext != &rDel) ) pData = pData->mpNext; - DBG_ASSERT( pData, "Menu::ImplRemoveDel(): ImplMenuDelData not registered !" ); + SAL_WARN_IF( !pData, "vcl", "Menu::ImplRemoveDel(): ImplMenuDelData not registered !" ); if( pData ) pData->mpNext = rDel.mpNext; } @@ -1499,7 +1499,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) // Separator if (!IsMenuBar()&& (pData->eType == MenuItemType::SEPARATOR)) { - //Useless: DBG_ASSERT( !IsMenuBar(), "Separator in MenuBar ?! " ); + //Useless: SAL_WARN_IF( IsMenuBar(), "vcl", "Separator in MenuBar ?! " ); pData->aSz.Height() = 4; } @@ -2899,7 +2899,7 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const Rectangl pSVData->maWinData.mpFirstFloat->EndPopupMode( FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll ); } - DBG_ASSERT( !ImplGetWindow(), "Win?!" ); + SAL_WARN_IF( ImplGetWindow(), "vcl", "Win?!" ); Rectangle aRect( rRect ); aRect.SetPos( pW->OutputToScreenPixel( aRect.TopLeft() ) ); @@ -3074,7 +3074,7 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const Rectangl pWin->Execute(); - DBG_ASSERT( ! pW->IsDisposed(), "window for popup died, modal count incorrect !" ); + SAL_WARN_IF( pW->IsDisposed(), "vcl", "window for popup died, modal count incorrect !" ); if( ! pW->IsDisposed() ) pW->ImplDecModalCount(); diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 0ff19712f5c9..d849a1d83359 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -509,7 +509,7 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b } nHighlightedItem = (sal_uInt16)n; - DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" ); + SAL_WARN_IF( ( nHighlightedItem != ITEMPOS_INVALID ) && !pMenu->ImplIsVisible( nHighlightedItem ), "vcl", "ChangeHighlightItem: Not visible!" ); if ( nHighlightedItem != ITEMPOS_INVALID ) Invalidate(); //HighlightItem( nHighlightedItem, true ); else if ( nRolloveredItem != ITEMPOS_INVALID ) @@ -1103,7 +1103,7 @@ sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<Me nId++; it = m_aAddButtons.find( nId ); } while( it != m_aAddButtons.end() && nId < 128 ); - DBG_ASSERT( nId < 128, "too many addbuttons in menubar" ); + SAL_WARN_IF( nId >= 128, "vcl", "too many addbuttons in menubar" ); AddButtonEntry& rNewEntry = m_aAddButtons[nId]; rNewEntry.m_nId = nId; rNewEntry.m_aSelectLink = i_rLink; diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 93ad9879d638..847d1ce16d5a 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -272,7 +272,7 @@ IMPL_LINK_NOARG_TYPED(MenuFloatingWindow, PopupEnd, FloatingWindow*, void) { if ( pActivePopup ) { - //DBG_ASSERT( !pActivePopup->ImplGetWindow(), "PopupEnd, obwohl pActivePopup MIT Window!" ); + //SAL_WARN_IF( pActivePopup->ImplGetWindow(), "vcl", "PopupEnd, obwohl pActivePopup MIT Window!" ); KillActivePopup(); // should be ok to just remove it //pActivePopup->bCanceled = true; } @@ -585,7 +585,7 @@ void MenuFloatingWindow::ImplScroll( bool bUp ) if ( bScrollUp && bUp ) { nFirstEntry = pMenu->ImplGetPrevVisible( nFirstEntry ); - DBG_ASSERT( nFirstEntry != ITEMPOS_INVALID, "Scroll?!" ); + SAL_WARN_IF( nFirstEntry == ITEMPOS_INVALID, "vcl", "Scroll?!" ); long nScrollEntryHeight = pMenu->GetItemList()->GetDataFromPos( nFirstEntry )->aSz.Height(); @@ -608,7 +608,7 @@ void MenuFloatingWindow::ImplScroll( bool bUp ) long nScrollEntryHeight = pMenu->GetItemList()->GetDataFromPos( nFirstEntry )->aSz.Height(); nFirstEntry = pMenu->ImplGetNextVisible( nFirstEntry ); - DBG_ASSERT( nFirstEntry != ITEMPOS_INVALID, "Scroll?!" ); + SAL_WARN_IF( nFirstEntry == ITEMPOS_INVALID, "vcl", "Scroll?!" ); if ( !bScrollUp ) { @@ -688,7 +688,7 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime } nHighlightedItem = (sal_uInt16)n; - DBG_ASSERT( pMenu->ImplIsVisible( nHighlightedItem ) || nHighlightedItem == ITEMPOS_INVALID, "ChangeHighlightItem: Not visible!" ); + SAL_WARN_IF( !pMenu->ImplIsVisible( nHighlightedItem ) && nHighlightedItem != ITEMPOS_INVALID, "vcl", "ChangeHighlightItem: Not visible!" ); if( nHighlightedItem != ITEMPOS_INVALID ) { if (pMenu->pStartedFrom && !pMenu->pStartedFrom->IsMenuBar()) @@ -785,7 +785,7 @@ void MenuFloatingWindow::RenderHighlightItem(vcl::RenderContext& rRenderContext, MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); if (n == nPos) { - DBG_ASSERT(pMenu->ImplIsVisible(n), "Highlight: Item not visible!"); + SAL_WARN_IF(!pMenu->ImplIsVisible(n), "vcl", "Highlight: Item not visible!"); if (pData->eType != MenuItemType::SEPARATOR) { bool bRestoreLineColor = false; @@ -869,7 +869,7 @@ Rectangle MenuFloatingWindow::ImplGetItemRect( sal_uInt16 nPos ) MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n ); if ( n == nPos ) { - DBG_ASSERT( pMenu->ImplIsVisible( n ), "ImplGetItemRect: Item not visible!" ); + SAL_WARN_IF( !pMenu->ImplIsVisible( n ), "vcl", "ImplGetItemRect: Item not visible!" ); if ( pData->eType != MenuItemType::SEPARATOR ) { aRect = Rectangle( Point( nX, nY ), Size( aSz.Width(), pData->aSz.Height() ) ); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 96477e3d8167..b8905bbe618f 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1340,7 +1340,7 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP bool bOutput = IsOutputEnabled(); EnableOutput(); - DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" ); + SAL_WARN_IF( GetMapMode().GetMapUnit() != MAP_PIXEL, "vcl", "MapMode must be PIXEL based" ); if ( GetMapMode().GetMapUnit() != MAP_PIXEL ) return; @@ -1453,8 +1453,8 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& / { // FIXME: scaling: currently this is for pixel copying only - DBG_ASSERT( ! pDev->HasMirroredGraphics(), "PaintToDevice to mirroring graphics" ); - DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" ); + SAL_WARN_IF( pDev->HasMirroredGraphics(), "vcl", "PaintToDevice to mirroring graphics" ); + SAL_WARN_IF( pDev->IsRTLEnabled(), "vcl", "PaintToDevice to mirroring device" ); vcl::Window* pRealParent = nullptr; if( ! mpWindowImpl->mbVisible ) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index e8cda0ce8c23..f62c9109d12e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1685,7 +1685,7 @@ PropertyValue* PrintDialog::getValueForWindow( vcl::Window* i_pWindow ) const if( it != maControlToPropertyMap.end() ) { pVal = maPController->getValue( it->second ); - DBG_ASSERT( pVal, "property value not found" ); + SAL_WARN_IF( !pVal, "vcl", "property value not found" ); } else { @@ -1737,7 +1737,7 @@ void PrintDialog::updateWindowFromProperty( const OUString& i_rProperty ) else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) ) { RadioButton* pBtn = dynamic_cast< RadioButton* >( rWindows[nVal].get() ); - DBG_ASSERT( pBtn, "unexpected control for property" ); + SAL_WARN_IF( !pBtn, "vcl", "unexpected control for property" ); if( pBtn ) pBtn->Check(); } diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx index 60355ee5b817..528659ec9162 100644 --- a/vcl/source/window/scrwnd.cxx +++ b/vcl/source/window/scrwnd.cxx @@ -46,7 +46,7 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) : mnActDeltaY ( 0L ) { // we need a parent - DBG_ASSERT( pParent, "ImplWheelWindow::ImplWheelWindow(): Parent not set!" ); + SAL_WARN_IF( !pParent, "vcl", "ImplWheelWindow::ImplWheelWindow(): Parent not set!" ); const Size aSize( pParent->GetOutputSizePixel() ); const StartAutoScrollFlags nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags; diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index 952dc8b1f777..05899554205d 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -352,7 +352,7 @@ void SelectionEngine::Command( const CommandEvent& rCEvt ) { if ( nFlags & SelectionEngineFlags::DRG_ENAB ) { - DBG_ASSERT( rCEvt.IsMouseEvent(), "STARTDRAG: Not a MouseEvent" ); + SAL_WARN_IF( !rCEvt.IsMouseEvent(), "vcl", "STARTDRAG: Not a MouseEvent" ); if ( pFunctionSet->IsSelectionAtPoint( rCEvt.GetMousePosPixel() ) ) { aLastMove = MouseEvent( rCEvt.GetMousePosPixel(), diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 21dfa64a0379..8986f99db13f 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -2652,7 +2652,7 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, { #ifdef DBG_UTIL sal_uInt16 nDbgDummy; - DBG_ASSERT( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::InsertItem() - Id already exists" ); + SAL_WARN_IF( ImplFindItem( mpMainSet, nId, nDbgDummy ), "vcl", "SplitWindow::InsertItem() - Id already exists" ); #endif // Size has to be at least 1. @@ -2661,7 +2661,7 @@ void SplitWindow::InsertItem( sal_uInt16 nId, vcl::Window* pWindow, long nSize, ImplSplitSet* pSet = ImplFindSet( mpMainSet, nIntoSetId ); #ifdef DBG_UTIL - DBG_ASSERT( pSet, "SplitWindow::InsertItem() - Set not exists" ); + SAL_WARN_IF( !pSet, "vcl", "SplitWindow::InsertItem() - Set not exists" ); #endif if(!pSet) { @@ -2718,7 +2718,7 @@ void SplitWindow::RemoveItem( sal_uInt16 nId ) { #ifdef DBG_UTIL sal_uInt16 nDbgDummy; - DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::RemoveItem() - Id not found" ); + SAL_WARN_IF( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "vcl", "SplitWindow::RemoveItem() - Id not found" ); #endif // search set diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx index b9bab21e9392..b1c54e502fe0 100644 --- a/vcl/source/window/stacking.cxx +++ b/vcl/source/window/stacking.cxx @@ -211,7 +211,7 @@ void Window::ImplToBottomChild() void Window::ImplCalcToTop( ImplCalcToTopData* pPrevData ) { - DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplCalcToTop(): Is not a OverlapWindow" ); + SAL_WARN_IF( !ImplIsOverlapWindow(), "vcl", "Window::ImplCalcToTop(): Is not a OverlapWindow" ); if ( !mpWindowImpl->mbFrame ) { @@ -238,7 +238,7 @@ void Window::ImplCalcToTop( ImplCalcToTopData* pPrevData ) void Window::ImplToTop( ToTopFlags nFlags ) { - DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplToTop(): Is not a OverlapWindow" ); + SAL_WARN_IF( !ImplIsOverlapWindow(), "vcl", "Window::ImplToTop(): Is not a OverlapWindow" ); if ( mpWindowImpl->mbFrame ) { @@ -463,7 +463,7 @@ void Window::SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags ) if (!pRefWindow || pRefWindow == this || mpWindowImpl->mbFrame) return; - DBG_ASSERT( pRefWindow->mpWindowImpl->mpParent == mpWindowImpl->mpParent, "Window::SetZOrder() - pRefWindow has other parent" ); + SAL_WARN_IF( pRefWindow->mpWindowImpl->mpParent != mpWindowImpl->mpParent, "vcl", "Window::SetZOrder() - pRefWindow has other parent" ); if ( nFlags & ZOrderFlags::Before ) { if ( pRefWindow->mpWindowImpl->mpPrev.get() == this ) @@ -842,8 +842,8 @@ static SystemWindow *ImplGetLastSystemWindow( vcl::Window *pWin ) void Window::SetParent( vcl::Window* pNewParent ) { - DBG_ASSERT( pNewParent, "Window::SetParent(): pParent == NULL" ); - DBG_ASSERT( pNewParent != this, "someone tried to reparent a window to itself" ); + SAL_WARN_IF( !pNewParent, "vcl", "Window::SetParent(): pParent == NULL" ); + SAL_WARN_IF( pNewParent == this, "vcl", "someone tried to reparent a window to itself" ); if( pNewParent == this ) return; @@ -1164,8 +1164,8 @@ void Window::ImplSetFrameParent( const vcl::Window* pParent ) // and reparent them if( ImplIsRealParentPath( pFrameWindow ) ) { - DBG_ASSERT( mpWindowImpl->mpFrame != pFrameWindow->mpWindowImpl->mpFrame, "SetFrameParent to own" ); - DBG_ASSERT( mpWindowImpl->mpFrame, "no frame" ); + SAL_WARN_IF( mpWindowImpl->mpFrame == pFrameWindow->mpWindowImpl->mpFrame, "vcl", "SetFrameParent to own" ); + SAL_WARN_IF( !mpWindowImpl->mpFrame, "vcl", "no frame" ); SalFrame* pParentFrame = pParent ? pParent->mpWindowImpl->mpFrame : nullptr; pFrameWindow->mpWindowImpl->mpFrame->SetParent( pParentFrame ); } diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index e02f427ee5e9..6736e1c54380 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -900,8 +900,8 @@ void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth, StatusBarItemBits nBits, long nOffset, sal_uInt16 nPos ) { - DBG_ASSERT( nItemId, "StatusBar::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( nItemId ) == STATUSBAR_ITEM_NOTFOUND, + SAL_WARN_IF( !nItemId, "vcl", "StatusBar::InsertItem(): ItemId == 0" ); + SAL_WARN_IF( GetItemPos( nItemId ) != STATUSBAR_ITEM_NOTFOUND, "vcl", "StatusBar::InsertItem(): ItemId already exists" ); // default: IN and CENTER @@ -1334,7 +1334,7 @@ OString StatusBar::GetHelpId( sal_uInt16 nItemId ) const void StatusBar::StartProgressMode( const OUString& rText ) { - DBG_ASSERT( !mbProgressMode, "StatusBar::StartProgressMode(): progress mode is active" ); + SAL_WARN_IF( mbProgressMode, "vcl", "StatusBar::StartProgressMode(): progress mode is active" ); mbProgressMode = true; mnPercent = 0; @@ -1354,7 +1354,7 @@ void StatusBar::StartProgressMode( const OUString& rText ) void StatusBar::SetProgressValue( sal_uInt16 nNewPercent ) { - DBG_ASSERT( mbProgressMode, "StatusBar::SetProgressValue(): no progress mode" ); + SAL_WARN_IF( !mbProgressMode, "vcl", "StatusBar::SetProgressValue(): no progress mode" ); SAL_WARN_IF( nNewPercent > 100, "vcl", "StatusBar::SetProgressValue(): nPercent > 100" ); if ( mbProgressMode @@ -1370,7 +1370,7 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent ) void StatusBar::EndProgressMode() { - DBG_ASSERT( mbProgressMode, "StatusBar::EndProgressMode(): no progress mode" ); + SAL_WARN_IF( !mbProgressMode, "vcl", "StatusBar::EndProgressMode(): no progress mode" ); mbProgressMode = false; maPrgsTxt.clear(); diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 660328b99825..80523b4a67e4 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -895,7 +895,7 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) } if ( pMenuBar ) { - DBG_ASSERT( !pMenuBar->pWindow, "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" ); + SAL_WARN_IF( pMenuBar->pWindow, "vcl", "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" ); pNewWindow = MenuBar::ImplCreate(mpWindowImpl->mpBorderWindow, pOldWindow, pMenuBar); static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow(pNewWindow); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index c1de5eb21c39..6265289e9a91 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -506,8 +506,8 @@ void ToolBox::InsertItem( const ResId& rResId ) { bNewCalc = true; - DBG_ASSERT( aItem.mnId, "ToolBox::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( aItem.mnId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::InsertItem(): ItemId already exists" ); + SAL_WARN_IF( !aItem.mnId, "vcl", "ToolBox::InsertItem(): ItemId == 0" ); + SAL_WARN_IF( GetItemPos( aItem.mnId ) != TOOLBOX_ITEM_NOTFOUND, "vcl", "ToolBox::InsertItem(): ItemId already exists" ); } // create item and add to list @@ -524,8 +524,8 @@ void ToolBox::InsertItem( const ResId& rResId ) void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBits nBits, sal_uInt16 nPos ) { - DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, + SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" ); + SAL_WARN_IF( GetItemPos( nItemId ) != TOOLBOX_ITEM_NOTFOUND, "vcl", "ToolBox::InsertItem(): ItemId already exists" ); // create item and add to list @@ -544,8 +544,8 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBi void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nBits, sal_uInt16 nPos ) { - DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, + SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" ); + SAL_WARN_IF( GetItemPos( nItemId ) != TOOLBOX_ITEM_NOTFOUND, "vcl", "ToolBox::InsertItem(): ItemId already exists" ); // create item and add to list @@ -563,8 +563,8 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const OUStrin void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, ToolBoxItemBits nBits, sal_uInt16 nPos ) { - DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, + SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" ); + SAL_WARN_IF( GetItemPos( nItemId ) != TOOLBOX_ITEM_NOTFOUND, "vcl", "ToolBox::InsertItem(): ItemId already exists" ); // create item and add to list @@ -601,8 +601,8 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css void ToolBox::InsertWindow( sal_uInt16 nItemId, vcl::Window* pWindow, ToolBoxItemBits nBits, sal_uInt16 nPos ) { - DBG_ASSERT( nItemId, "ToolBox::InsertWindow(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, + SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertWindow(): ItemId == 0" ); + SAL_WARN_IF( GetItemPos( nItemId ) != TOOLBOX_ITEM_NOTFOUND, "vcl", "ToolBox::InsertWindow(): ItemId already exists" ); // create item and add to list @@ -708,7 +708,7 @@ void ToolBox::RemoveItem( sal_uInt16 nPos ) void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId ) { - DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, + SAL_WARN_IF( GetItemPos( nItemId ) != TOOLBOX_ITEM_NOTFOUND, "vcl", "ToolBox::CopyItem(): ItemId already exists" ); sal_uInt16 nPos = rToolBox.GetItemPos( nItemId ); @@ -1943,8 +1943,8 @@ void ToolBox::ExecuteCustomMenu() // checks override first, useful during calculation of sizes bool ToolBox::ImplIsFloatingMode() const { - DBG_ASSERT( !(mpData->mbAssumeDocked && mpData->mbAssumeFloating), - "ToolBox::ImplIsFloatingMode(): cannot assume docked and floating" ); + SAL_WARN_IF( mpData->mbAssumeDocked && mpData->mbAssumeFloating, "vcl", + "cannot assume docked and floating" ); if( mpData->mbAssumeDocked ) return false; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index e70cdc6d99f3..63df1d3a21ec 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -245,9 +245,9 @@ void Window::dispose() if ( pSVData->maHelpData.mpHelpWin && (pSVData->maHelpData.mpHelpWin->GetParent() == this) ) ImplDestroyHelpWindow( true ); - DBG_ASSERT( pSVData->maWinData.mpTrackWin.get() != this, + SAL_WARN_IF( pSVData->maWinData.mpTrackWin.get() == this, "vcl", "Window::~Window(): Window is in TrackingMode" ); - DBG_ASSERT(!IsMouseCaptured(), + SAL_WARN_IF(IsMouseCaptured(), "vcl", "Window::~Window(): Window has the mouse captured"); // due to old compatibility @@ -523,7 +523,7 @@ void Window::dispose() auto myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(), pParentWinData->maTopWindowChildren.end(), VclPtr<vcl::Window>(this) ); - DBG_ASSERT( myPos != pParentWinData->maTopWindowChildren.end(), "Window::~Window: inconsistency in top window chain!" ); + SAL_WARN_IF( myPos == pParentWinData->maTopWindowChildren.end(), "vcl", "Window::~Window: inconsistency in top window chain!" ); if ( myPos != pParentWinData->maTopWindowChildren.end() ) pParentWinData->maTopWindowChildren.erase( myPos ); } @@ -894,7 +894,7 @@ static sal_Int32 CountDPIScaleFactor(sal_Int32 nDPI) void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ) { - DBG_ASSERT( mpWindowImpl->mbFrame || pParent || GetType() == WINDOW_FIXEDIMAGE, + SAL_WARN_IF( !mpWindowImpl->mbFrame && !pParent && GetType() != WINDOW_FIXEDIMAGE, "vcl", "Window::Window(): pParent == NULL" ); ImplSVData* pSVData = ImplGetSVData(); @@ -2359,7 +2359,7 @@ void Window::Show(bool bVisible, ShowFlags nFlags) pSVData->mpIntroWindow->Hide(); } - //DBG_ASSERT( !mpWindowImpl->mbSuppressAccessibilityEvents, "Window::Show() - Frame reactivated"); + //SAL_WARN_IF( mpWindowImpl->mbSuppressAccessibilityEvents, "vcl", "Window::Show() - Frame reactivated"); mpWindowImpl->mbSuppressAccessibilityEvents = false; mpWindowImpl->mbPaintFrame = true; @@ -3189,7 +3189,7 @@ Reference< css::awt::XWindowPeer > Window::GetComponentInterface( bool bCreate ) void Window::SetComponentInterface( Reference< css::awt::XWindowPeer > xIFace ) { UnoWrapperBase* pWrapper = Application::GetUnoWrapper(); - DBG_ASSERT( pWrapper, "SetComponentInterface: No Wrapper!" ); + SAL_WARN_IF( !pWrapper, "vcl", "SetComponentInterface: No Wrapper!" ); if ( pWrapper ) pWrapper->SetWindowInterface( this, xIFace ); } diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 86871b7fd7f4..733361278d4f 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -332,7 +332,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent { pChild = pSVData->maWinData.mpCaptureWin; - DBG_ASSERT( xWindow == pChild->ImplGetFrameWindow(), + SAL_WARN_IF( xWindow != pChild->ImplGetFrameWindow(), "vcl", "ImplHandleMouseEvent: mouse event is not sent to capture window" ); // java client cannot capture mouse correctly @@ -601,7 +601,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent pSVData->maAppData.mnLastInputTime = tools::Time::GetSystemTicks(); } - DBG_ASSERT( pChild, "ImplHandleMouseEvent: pChild == NULL" ); + SAL_WARN_IF( !pChild, "vcl", "ImplHandleMouseEvent: pChild == NULL" ); if (!pChild) return false; @@ -631,7 +631,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent // call handler bool bDrag = false; bool bCallHelpRequest = true; - DBG_ASSERT( pChild, "ImplHandleMouseEvent: pChild is NULL" ); + SAL_WARN_IF( !pChild, "vcl", "ImplHandleMouseEvent: pChild is NULL" ); if (!pChild) return false; diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index ecd580f73a72..cacdfa0857b4 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -60,7 +60,7 @@ void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentDat if ( nStyle & WB_APP ) { ImplSVData* pSVData = ImplGetSVData(); - DBG_ASSERT( !pSVData->maWinData.mpAppWin, "WorkWindow::WorkWindow(): More than one window with style WB_APP" ); + SAL_WARN_IF( pSVData->maWinData.mpAppWin, "vcl", "WorkWindow::WorkWindow(): More than one window with style WB_APP" ); pSVData->maWinData.mpAppWin = this; } @@ -74,7 +74,7 @@ void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, const css::uno: css::uno::Sequence< sal_Int8 > aSeq; aSystemWorkWindowToken >>= aSeq; SystemParentData* pData = reinterpret_cast<SystemParentData*>(aSeq.getArray()); - DBG_ASSERT( aSeq.getLength() == sizeof( SystemParentData ) && pData->nSize == sizeof( SystemParentData ), "WorkWindow::WorkWindow( vcl::Window*, const Any&, WinBits ) called with invalid Any" ); + SAL_WARN_IF( aSeq.getLength() != sizeof( SystemParentData ) || pData->nSize != sizeof( SystemParentData ), "vcl", "WorkWindow::WorkWindow( vcl::Window*, const Any&, WinBits ) called with invalid Any" ); // init with style 0 as does WorkWindow::WorkWindow( SystemParentData* ); ImplInit( pParent, 0, pData ); } @@ -216,7 +216,7 @@ bool WorkWindow::IsMinimized() const bool WorkWindow::SetPluginParent( SystemParentData* pParent ) { - DBG_ASSERT( ! mbPresentationMode && ! mbFullScreenMode, "SetPluginParent in fullscreen or presentation mode !" ); + SAL_WARN_IF( mbPresentationMode || mbFullScreenMode, "vcl", "SetPluginParent in fullscreen or presentation mode !" ); bool bWasDnd = Window::ImplStopDnd(); |