vcl/osx/salframe.cxx | 6 - vcl/osx/salinst.cxx | 10 +- vcl/osx/salmenu.cxx | 6 - vcl/quartz/ctfonts.cxx | 2 vcl/quartz/ctlayout.cxx | 2 vcl/quartz/salbmp.cxx | 2 vcl/quartz/salgdi.cxx | 22 ++--- vcl/quartz/salgdicommon.cxx | 2 vcl/quartz/salgdiutils.cxx | 4 vcl/source/app/help.cxx | 6 - vcl/source/app/session.cxx | 4 vcl/source/app/svapp.cxx | 10 +- vcl/source/app/svmain.cxx | 4 vcl/source/app/unohelp2.cxx | 2 vcl/source/control/button.cxx | 4 vcl/source/control/combobox.cxx | 2 vcl/source/control/ctrl.cxx | 4 vcl/source/control/edit.cxx | 2 vcl/source/control/field.cxx | 12 +- vcl/source/control/imp_listbox.cxx | 2 vcl/source/control/listbox.cxx | 2 vcl/source/control/longcurr.cxx | 2 vcl/source/control/spinfld.cxx | 2 vcl/source/control/tabctrl.cxx | 6 - vcl/source/edit/textdata.cxx | 6 - vcl/source/edit/textdoc.cxx | 26 +++--- vcl/source/edit/texteng.cxx | 106 ++++++++++++------------- vcl/source/edit/textundo.cxx | 2 vcl/source/edit/textview.cxx | 12 +- vcl/source/filter/graphicfilter.cxx | 6 - vcl/source/filter/wmf/emfwr.cxx | 12 +- vcl/source/filter/wmf/enhwmf.cxx | 2 vcl/source/filter/wmf/winwmf.cxx | 2 vcl/source/font/fontcache.cxx | 2 vcl/source/fontsubset/fontsubset.cxx | 4 vcl/source/fontsubset/xlat.cxx | 2 vcl/source/gdi/animate.cxx | 16 +-- vcl/source/gdi/bitmap3.cxx | 6 - vcl/source/gdi/bitmapex.cxx | 10 +- vcl/source/gdi/bmpacc.cxx | 8 - vcl/source/gdi/bmpfast.cxx | 4 vcl/source/gdi/gfxlink.cxx | 2 vcl/source/gdi/impvect.cxx | 4 vcl/source/gdi/jobset.cxx | 6 - vcl/source/gdi/pdfextoutdevdata.cxx | 8 - vcl/source/gdi/pdfwriter_impl.cxx | 34 ++++---- vcl/source/gdi/print.cxx | 6 - vcl/source/gdi/print2.cxx | 6 - vcl/source/gdi/print3.cxx | 4 vcl/source/gdi/regband.cxx | 16 +-- vcl/source/gdi/regionband.cxx | 16 +-- vcl/source/gdi/salgdilayout.cxx | 6 - vcl/source/gdi/sallayout.cxx | 2 vcl/source/gdi/svmconverter.cxx | 8 - vcl/source/helper/lazydelete.cxx | 2 vcl/source/image/ImageList.cxx | 2 vcl/source/outdev/font.cxx | 4 vcl/source/outdev/map.cxx | 4 vcl/source/outdev/outdev.cxx | 2 vcl/source/outdev/pixel.cxx | 2 vcl/source/outdev/text.cxx | 14 +-- vcl/source/window/accel.cxx | 2 vcl/source/window/accessibility.cxx | 6 - vcl/source/window/dialog.cxx | 6 - vcl/source/window/dlgctrl.cxx | 4 vcl/source/window/dockmgr.cxx | 4 vcl/source/window/dockwin.cxx | 2 vcl/source/window/event.cxx | 4 vcl/source/window/floatwin.cxx | 4 vcl/source/window/menu.cxx | 20 ++-- vcl/source/window/menubarwindow.cxx | 4 vcl/source/window/menufloatingwindow.cxx | 12 +- vcl/source/window/paint.cxx | 6 - vcl/source/window/printdlg.cxx | 4 vcl/source/window/scrwnd.cxx | 2 vcl/source/window/seleng.cxx | 2 vcl/source/window/splitwin.cxx | 6 - vcl/source/window/stacking.cxx | 14 +-- vcl/source/window/status.cxx | 10 +- vcl/source/window/syswin.cxx | 2 vcl/source/window/toolbox2.cxx | 26 +++--- vcl/source/window/window.cxx | 12 +- vcl/source/window/winproc.cxx | 6 - vcl/source/window/wrkwin.cxx | 6 - vcl/unx/generic/app/saldata.cxx | 6 - vcl/unx/generic/app/saldisp.cxx | 50 +++++------ vcl/unx/generic/fontmanager/fontmanager.cxx | 6 - vcl/unx/generic/gdi/gdiimpl.cxx | 4 vcl/unx/generic/gdi/salbmp.cxx | 2 vcl/unx/generic/gdi/salgdi.cxx | 2 vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 12 +- vcl/unx/generic/glyphs/glyphcache.cxx | 4 vcl/unx/generic/print/genpspgraphics.cxx | 2 vcl/unx/generic/printer/printerinfomanager.cxx | 4 vcl/unx/generic/window/salframe.cxx | 4 vcl/unx/generic/window/salobj.cxx | 2 vcl/unx/gtk/gtksalframe.cxx | 2 vcl/unx/gtk3/gtk3gtkframe.cxx | 2 vcl/win/app/salshl.cxx | 10 +- vcl/win/gdi/gdiimpl.cxx | 6 - vcl/win/gdi/salbmp.cxx | 2 vcl/win/gdi/salfont.cxx | 8 - vcl/win/gdi/winlayout.cxx | 12 +- vcl/win/window/salframe.cxx | 16 +-- vcl/win/window/salobj.cxx | 2 105 files changed, 408 insertions(+), 408 deletions(-)
New commits: commit 9c79945ca62b18213728cdd23d9f390304aee1de Author: Noel Grandin <noelgran...@gmail.com> Date: Sun Jun 12 20:11:20 2016 +0200 convert DBG_ASSERT in vcl Change-Id: I732fb1a789f90ca7a7f393cc41a6afe84fecf3d3 Reviewed-on: https://gerrit.libreoffice.org/26200 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index dae0aef..b5a1499 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -107,7 +107,7 @@ AquaSalFrame::~AquaSalFrame() pSalData->maFrameCheck.erase( this ); pSalData->maPresentationFrames.remove( this ); - DBG_ASSERT( this != s_pCaptureFrame, "capture frame destroyed" ); + SAL_WARN_IF( this == s_pCaptureFrame, "vcl", "capture frame destroyed" ); if( this == s_pCaptureFrame ) s_pCaptureFrame = nullptr; @@ -277,7 +277,7 @@ SalGraphics* AquaSalFrame::AcquireGraphics() void AquaSalFrame::ReleaseGraphics( SalGraphics *pGraphics ) { (void)pGraphics; - DBG_ASSERT( pGraphics == mpGraphics, "graphics released on wrong frame" ); + SAL_WARN_IF( pGraphics != mpGraphics, "vcl", "graphics released on wrong frame" ); mbGraphics = FALSE; } @@ -1470,7 +1470,7 @@ void AquaSalFrame::SetMenu( SalMenu* pSalMenu ) SalData::ensureThreadAutoreleasePool(); AquaSalMenu* pMenu = static_cast<AquaSalMenu*>(pSalMenu); - DBG_ASSERT( ! pMenu || pMenu->mbMenuBar, "setting non menubar on frame" ); + SAL_WARN_IF( pMenu && !pMenu->mbMenuBar, "vcl", "setting non menubar on frame" ); mpMenu = pMenu; if( mpMenu ) mpMenu->setMainMenu(); diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx index 54c3ba9..ad3980e 100644 --- a/vcl/osx/salinst.cxx +++ b/vcl/osx/salinst.cxx @@ -324,7 +324,7 @@ SalInstance* CreateSalInstance() initNSApp(); SalData* pSalData = GetSalData(); - DBG_ASSERT( pSalData->mpFirstInstance == nullptr, "more than one instance created" ); + SAL_WARN_IF( pSalData->mpFirstInstance != nullptr, "vcl", "more than one instance created" ); AquaSalInstance* pInst = new AquaSalInstance; // init instance (only one instance in this version !!!) @@ -807,7 +807,7 @@ void AquaSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) NSArray* pTypes = [NSPrinter printerTypes]; unsigned int nNameCount = pNames ? [pNames count] : 0; unsigned int nTypeCount = pTypes ? [pTypes count] : 0; - DBG_ASSERT( nTypeCount == nNameCount, "type count not equal to printer count" ); + SAL_WARN_IF( nTypeCount != nNameCount, "vcl", "type count not equal to printer count" ); for( unsigned int i = 0; i < nNameCount; i++ ) { NSString* pName = [pNames objectAtIndex: i]; @@ -844,15 +844,15 @@ OUString AquaSalInstance::GetDefaultPrinter() if( maDefaultPrinter.isEmpty() ) { NSPrintInfo* pPI = [NSPrintInfo sharedPrintInfo]; - DBG_ASSERT( pPI, "no print info" ); + SAL_WARN_IF( !pPI, "vcl", "no print info" ); if( pPI ) { NSPrinter* pPr = [pPI printer]; - DBG_ASSERT( pPr, "no printer in default info" ); + SAL_WARN_IF( !pPr, "vcl", "no printer in default info" ); if( pPr ) { NSString* pDefName = [pPr name]; - DBG_ASSERT( pDefName, "printer has no name" ); + SAL_WARN_IF( !pDefName, "vcl", "printer has no name" ); maDefaultPrinter = GetOUString( pDefName ); } } diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index b5f3bad..b9d8e69 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -392,7 +392,7 @@ void AquaSalMenu::unsetMainMenu() void AquaSalMenu::setMainMenu() { - DBG_ASSERT( mbMenuBar, "setMainMenu on non menubar" ); + SAL_WARN_IF( !mbMenuBar, "vcl", "setMainMenu on non menubar" ); if( mbMenuBar ) { if( pCurrentMenuBar != this ) @@ -718,7 +718,7 @@ void AquaSalMenu::SetAccelerator( unsigned /*nPos*/, SalMenuItem* pSalMenuItem, else // not even a code ? nonsense -> ignore return; - DBG_ASSERT( nCommandKey, "unmapped accelerator key" ); + SAL_WARN_IF( !nCommandKey, "vcl", "unmapped accelerator key" ); nModifier=rKeyCode.GetModifier(); @@ -888,7 +888,7 @@ AquaSalMenuItem::AquaSalMenuItem( const SalItemParams* pItemData ) : [pString release]; } // anything but a separator should set a menu to dispatch to - DBG_ASSERT( mpVCLMenu, "no menu" ); + SAL_WARN_IF( !mpVCLMenu, "vcl", "no menu" ); } } diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 5f4347b..5bd6e7b 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -248,7 +248,7 @@ LogicalFontInstance* CoreTextFontFace::CreateFontInstance( /*const*/ FontSelectP int CoreTextFontFace::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const { - DBG_ASSERT( pTagName[4]=='\0', "CoreTextFontFace::GetFontTable with invalid tagname!\n" ); + SAL_WARN_IF( pTagName[4]!='\0', "vcl", "CoreTextFontFace::GetFontTable with invalid tagname!\n" ); const CTFontTableTag nTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0); diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index 6bdcad3..0c46c95 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -698,7 +698,7 @@ sal_Int32 CTLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordinate n void CTLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) const { - DBG_ASSERT( ((nMaxIndex>0)&&!(nMaxIndex&1)), + SAL_WARN_IF( (nMaxIndex<=0) || (nMaxIndex&1), "vcl", "CTLayout::GetCaretPositions() : invalid number of caret pairs requested"); // initialize the caret positions diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index 4ec0809..7c44fb2 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -109,7 +109,7 @@ QuartzSalBitmap::~QuartzSalBitmap() bool QuartzSalBitmap::Create( CGLayerRef xLayer, int nBitmapBits, int nX, int nY, int nWidth, int nHeight ) { - DBG_ASSERT( xLayer, "QuartzSalBitmap::Create() from non-layered context" ); + SAL_WARN_IF( !xLayer, "vcl", "QuartzSalBitmap::Create() from non-layered context" ); // sanitize input parameters if( nX < 0 ) { diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 67d1d82..c28290a 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -103,18 +103,18 @@ const FontCharMapPtr CoreTextFontFace::GetFontCharMap() const // get the CMAP byte size // allocate a buffer for the CMAP raw data const int nBufSize = GetFontTable( "cmap", nullptr ); - DBG_ASSERT( (nBufSize > 0), "CoreTextFontFace::GetFontCharMap : GetFontTable1 failed!\n"); + SAL_WARN_IF( (nBufSize <= 0), "vcl", "CoreTextFontFace::GetFontCharMap : GetFontTable1 failed!\n"); if( nBufSize <= 0 ) return mxCharMap; // get the CMAP raw data std::vector<unsigned char> aBuffer( nBufSize ); const int nRawLength = GetFontTable( "cmap", &aBuffer[0] ); - DBG_ASSERT( (nRawLength > 0), "CoreTextFontFace::GetFontCharMap : GetFontTable2 failed!\n"); + SAL_WARN_IF( (nRawLength <= 0), "vcl", "CoreTextFontFace::GetFontCharMap : GetFontTable2 failed!\n"); if( nRawLength <= 0 ) return mxCharMap; - DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontFace::GetFontCharMap : ByteCount mismatch!\n"); + SAL_WARN_IF( (nBufSize!=nRawLength), "vcl", "CoreTextFontFace::GetFontCharMap : ByteCount mismatch!\n"); // parse the CMAP CmapResult aCmapResult; @@ -183,18 +183,18 @@ void CoreTextFontFace::ReadOs2Table() const // prepare to get the OS/2 table raw data const int nBufSize = GetFontTable( "OS/2", nullptr ); - DBG_ASSERT( (nBufSize > 0), "CoreTextFontFace::ReadOs2Table : GetFontTable1 failed!\n"); + SAL_WARN_IF( (nBufSize <= 0), "vcl", "CoreTextFontFace::ReadOs2Table : GetFontTable1 failed!\n"); if( nBufSize <= 0 ) return; // get the OS/2 raw data std::vector<unsigned char> aBuffer( nBufSize ); const int nRawLength = GetFontTable( "cmap", &aBuffer[0] ); - DBG_ASSERT( (nRawLength > 0), "CoreTextFontFace::ReadOs2Table : GetFontTable2 failed!\n"); + SAL_WARN_IF( (nRawLength <= 0), "vcl", "CoreTextFontFace::ReadOs2Table : GetFontTable2 failed!\n"); if( nRawLength <= 0 ) return; - DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontFace::ReadOs2Table : ByteCount mismatch!\n"); + SAL_WARN_IF( (nBufSize!=nRawLength), "vcl", "CoreTextFontFace::ReadOs2Table : ByteCount mismatch!\n"); mbHasOs2Table = true; // parse the OS/2 raw data @@ -218,7 +218,7 @@ void CoreTextFontFace::ReadMacCmapEncoding() const const int nRawLength = GetFontTable( "cmap", &aBuffer[0] ); if( nRawLength < 24 ) return; - DBG_ASSERT( (nBufSize==nRawLength), "CoreTextFontFace::ReadMacCmapEncoding : ByteCount mismatch!\n"); + SAL_WARN_IF( (nBufSize!=nRawLength), "vcl", "CoreTextFontFace::ReadMacCmapEncoding : ByteCount mismatch!\n"); const unsigned char* pCmap = &aBuffer[0]; if( GetUShort( pCmap ) != 0x0000 ) @@ -368,7 +368,7 @@ static void AddLocalTempFontDirs() void AquaSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection ) { - DBG_ASSERT( pFontCollection, "AquaSalGraphics::GetDevFontList(NULL) !"); + SAL_WARN_IF( !pFontCollection, "vcl", "AquaSalGraphics::GetDevFontList(NULL) !"); AddLocalTempFontDirs(); @@ -683,7 +683,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData, nOfs += nPrepSize; } - DBG_ASSERT( (nOfs==nTotalSize), "AquaSalGraphics::CreateFontSubset (nOfs!=nTotalSize)"); + SAL_WARN_IF( (nOfs!=nTotalSize), "vcl", "AquaSalGraphics::CreateFontSubset (nOfs!=nTotalSize)"); return true; } @@ -741,7 +741,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV } FontCharMapPtr xFCMap = mpFontData->GetFontCharMap(); - DBG_ASSERT( xFCMap && xFCMap->GetCharCount(), "no charmap" ); + SAL_WARN_IF( !xFCMap || !xFCMap->GetCharCount(), "vcl", "no charmap" ); // get unicode<->glyph encoding // TODO? avoid sft mapping by using the xFCMap itself @@ -788,7 +788,7 @@ void AquaSalGraphics::FreeEmbedFontData( const void* pData, long /*nDataLen*/ ) // TODO: implementing this only makes sense when the implementation of // AquaSalGraphics::GetEmbedFontData() returns non-NULL (void)pData; - DBG_ASSERT( (pData!=nullptr), "AquaSalGraphics::FreeEmbedFontData() is not implemented\n"); + SAL_WARN_IF( (pData==nullptr), "vcl", "AquaSalGraphics::FreeEmbedFontData() is not implemented\n"); } bool AquaSalGraphics::IsFlipped() const diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 9b966c6..4f90876 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -2027,7 +2027,7 @@ void AquaSalGraphics::SetXORMode( bool bSet ) void AquaSalGraphics::updateResolution() { - DBG_ASSERT( mbWindow, "updateResolution on inappropriate graphics" ); + SAL_WARN_IF( !mbWindow, "vcl", "updateResolution on inappropriate graphics" ); initResolution( (mbWindow && mpFrame) ? mpFrame->getNSWindow() : nil ); } diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx index 13050e4..7a5850e 100644 --- a/vcl/quartz/salgdiutils.cxx +++ b/vcl/quartz/salgdiutils.cxx @@ -163,7 +163,7 @@ bool AquaSalGraphics::CheckContext() } } - DBG_ASSERT( mrContext || mbPrinter, "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" ); + SAL_WARN_IF( !mrContext && !mbPrinter, "vcl", "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" ); return (mrContext != nullptr); } @@ -216,7 +216,7 @@ void AquaSalGraphics::UpdateWindow( NSRect& ) } else { - DBG_ASSERT( mpFrame->mbInitShow, "UpdateWindow called on uneligible graphics" ); + SAL_WARN_IF( !mpFrame->mbInitShow, "vcl", "UpdateWindow called on uneligible graphics" ); } } diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 8c1f902..1e5da11 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 f3f7fa3a..8e99853 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 7fc4d4c..494e541 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 2ebb805..8ed72ec 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 0db903a..125a8ad 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 84d19f7..5399ae2 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 b3716f0..2e0e328 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 26cf163..41e1336 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 fdbb0aa..4595309 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 1997cc1..3b2c020 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 669078b..d38f590 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 3492881..9fbb4dc 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 d58bd19..6eb44c5 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 1fade35..d0247fb 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 88e4eb7..8b97030 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 570d517..0289705 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 eceaeb8..0e935a9 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 73dc5f4e..675d2df 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 91237d3..6cdd444 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 f62306f..99f83fc 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 14088b5..da9d790 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 8c352fa..e71f14c 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 d7b7fe2..c8f72a9 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 5c3ccd8..6cc7ae9 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 f0e0dbf..4991b6d 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 a1a1476..4eca8a4 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 6fc4cb7..f78674b 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 133bb91..2f4fabf 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 9e5af0e..c5de584 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 220c716..611c420 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 3bc0a55..8357784 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 6dd2c96..6baf993 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 30e7454..39ff4e2 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 dc70e05..d8edab2 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 00362bb..2b795e5 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 2647047..abd08d8 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 ff0bc1a..f719e70 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 6b57e48..23dd0f2 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 c2e589d..b2e6bac 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 8b17c70..7b244ca 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 4961a17..d59f5c8 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 4466375..73e7d4a 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) ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits