[Libreoffice-commits] core.git: starmath/inc starmath/source

Rohan Kumar rohankanojia420 at gmail.com
Mon Mar 21 17:02:22 UTC 2016


 starmath/inc/parse.hxx            |    2 
 starmath/inc/view.hxx             |    7 ---
 starmath/source/accessibility.cxx |    8 +--
 starmath/source/dialog.cxx        |   85 ++++++++------------------------------
 starmath/source/document.cxx      |    7 ---
 starmath/source/edit.cxx          |    3 -
 starmath/source/mathtype.cxx      |    7 ---
 starmath/source/parse.cxx         |   12 -----
 starmath/source/view.cxx          |   15 ------
 9 files changed, 29 insertions(+), 117 deletions(-)

New commits:
commit 28aaa27438fb3a743792ce821ba1f523a5d9947f
Author: Rohan Kumar <rohankanojia420 at gmail.com>
Date:   Thu Mar 17 12:03:50 2016 +0530

    tdf#91794 remove OSL_DEBUG_LEVEL > 1 conditionals
    
    I removed all the OSL_DEBUG_LEVEL > 1 conditionals and also
    made SAL_WARN open to production code which was earlier under
    OSL_DEBUG_LEVEL > 0
    
    Change-Id: Ibe71defed9a7191ec8e4a934e746ef0f3ebd8b3a
    Reviewed-on: https://gerrit.libreoffice.org/23065
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 8c51220..3ae3f66 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -53,9 +53,7 @@ class SmParser
     SmParser(const SmParser&) = delete;
     SmParser& operator=(const SmParser&) = delete;
 
-#if OSL_DEBUG_LEVEL > 1
     bool            IsDelimiter( const OUString &rTxt, sal_Int32 nPos );
-#endif
     void            NextToken();
     sal_Int32       GetTokenIndex() const   { return m_nTokenIndex; }
     void            Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText );
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 37344be..397dca9 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -161,9 +161,6 @@ protected:
 
 public:
     SmEditController(SmEditWindow &, sal_uInt16, SfxBindings  & );
-#if OSL_DEBUG_LEVEL > 1
-    virtual ~SmEditController();
-#endif
 
     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) override;
 };
@@ -216,10 +213,6 @@ class SmCmdBoxWrapper : public SfxChildWindow
 protected:
     SmCmdBoxWrapper(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo);
 
-#if OSL_DEBUG_LEVEL > 1
-    virtual ~SmCmdBoxWrapper();
-#endif
-
 public:
 
     SmEditWindow& GetEditWindow()
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 17e8624..93656c7 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -240,10 +240,10 @@ awt::Size SAL_CALL SmGraphicAccessible::getSize()
             "mismatch of window parent and accessible parent" );
 
     Size aSz( pWin->GetSizePixel() );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
     awt::Rectangle aRect( lcl_GetBounds( pWin ) );
     Size aSz2( aRect.Width, aRect.Height );
-    OSL_ENSURE( aSz == aSz2, "mismatch in width" );
+    assert(aSz == aSz2 && "mismatch in width" );
 #endif
     return awt::Size( aSz.Width(), aSz.Height() );
 }
@@ -1718,10 +1718,10 @@ awt::Size SAL_CALL SmEditAccessible::getSize(  )
             "mismatch of window parent and accessible parent" );
 
     Size aSz( pWin->GetSizePixel() );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
     awt::Rectangle aRect( lcl_GetBounds( pWin ) );
     Size aSz2( aRect.Width, aRect.Height );
-    OSL_ENSURE( aSz == aSz2, "mismatch in width" );
+    assert(aSz == aSz2 && "mismatch in width");
 #endif
     return awt::Size( aSz.Width(), aSz.Height() );
 }
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 87fba57..9a2f2a0 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -151,9 +151,7 @@ void SetFontStyle(const OUString &rStyleName, vcl::Font &rFont)
         for (i = 0;  i < SmFontStyles::GetCount(); ++i)
             if (rStyleName == rStyles.GetStyleName(i))
                 break;
-#if OSL_DEBUG_LEVEL > 1
-        OSL_ENSURE(i < rStyles.GetCount(), "style-name unknown");
-#endif
+        assert(i < rStyles.GetCount() && "style-name unknown");
         nIndex = i;
     }
 
@@ -766,16 +764,11 @@ void SmDistanceDialog::SetHelpId(MetricField &rField, const OString& sHelpId)
 
 void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
 {
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(/*0 <= nCategory  &&*/  nCategory < NOCATEGORIES,
-        "Sm: wrong category number in SmDistanceDialog");
-#endif
+    assert(nCategory < NOCATEGORIES && "Sm: wrong category number in SmDistanceDialog");
 
     // array to convert category- and metricfield-number in help ids.
     // 0 is used in case of unused combinations.
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(NOCATEGORIES == 10, "Sm : array doesn't fit into the number of categories");
-#endif
+    assert(NOCATEGORIES == 10 && "Sm : array doesn't fit into the number of categories");
     static const char * aCatMf2Hid[10][4] =
     {
         { HID_SMA_DEFAULT_DIST,         HID_SMA_LINE_DIST,          HID_SMA_ROOT_DIST, nullptr },
@@ -1666,11 +1659,6 @@ void SmShowChar::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRec
     OUString aText( GetText() );
     if (!aText.isEmpty())
     {
-#if OSL_DEBUG_LEVEL > 1
-        sal_Int32 nPos = 0;
-        sal_UCS4 cChar = aText.iterateCodePoints( &nPos );
-        (void) cChar;
-#endif
         Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
 
         rRenderContext.DrawText(Point((GetOutputSize().Width()  - aTextSize.Width())  / 2,
@@ -1713,10 +1701,7 @@ void SmShowChar::Resize()
 
 void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, bool bDeleteText)
 {
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pOldSymbols  ||  &rComboBox == pSymbols,
-        "Sm : wrong ComboBox");
-#endif
+    assert((&rComboBox == pOldSymbols || &rComboBox == pSymbols) && "Sm : wrong ComboBox");
 
     rComboBox.Clear();
     if (bDeleteText)
@@ -1731,10 +1716,7 @@ void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, bool bDeleteText)
 
 void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, bool bDeleteText)
 {
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pOldSymbolSets  ||  &rComboBox == pSymbolSets,
-        "Sm : falsche ComboBox");
-#endif
+    assert((&rComboBox == pOldSymbolSets || &rComboBox == pSymbolSets) && "Sm : falsche ComboBox");
 
     rComboBox.Clear();
     if (bDeleteText)
@@ -1777,9 +1759,7 @@ void SmSymDefineDialog::FillStyles()
         for (sal_uInt16 i = 0;  i < SmFontStyles::GetCount();  i++)
             pStyles->InsertEntry( rStyles.GetStyleName(i) );
 
-#if OSL_DEBUG_LEVEL > 1
-        OSL_ENSURE(pStyles->GetEntryCount() > 0, "Sm : no styles available");
-#endif
+        assert(pStyles->GetEntryCount() > 0 && "Sm : no styles available");
         pStyles->SetText( pStyles->GetEntry(0) );
     }
 }
@@ -1787,10 +1767,7 @@ void SmSymDefineDialog::FillStyles()
 
 SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox)
 {
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pOldSymbols  ||  &rComboBox == pSymbols,
-        "Sm : wrong combobox");
-#endif
+    assert((&rComboBox == pOldSymbols || &rComboBox == pSymbols) && "Sm : wrong combobox");
     return aSymbolMgrCopy.GetSymbolByName(rComboBox.GetText());
 }
 
@@ -1798,9 +1775,7 @@ SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox)
 IMPL_LINK_TYPED( SmSymDefineDialog, OldSymbolChangeHdl, ComboBox&, rComboBox, void )
 {
     (void) rComboBox;
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pOldSymbols, "Sm : wrong argument");
-#endif
+    assert(&rComboBox == pOldSymbols && "Sm : wrong argument");
     SelectSymbol(*pOldSymbols, pOldSymbols->GetText(), false);
 }
 
@@ -1808,9 +1783,7 @@ IMPL_LINK_TYPED( SmSymDefineDialog, OldSymbolChangeHdl, ComboBox&, rComboBox, vo
 IMPL_LINK_TYPED( SmSymDefineDialog, OldSymbolSetChangeHdl, ComboBox&, rComboBox, void )
 {
     (void) rComboBox;
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pOldSymbolSets, "Sm : wrong argument");
-#endif
+    assert(&rComboBox == pOldSymbolSets && "Sm : wrong argument");
     SelectSymbolSet(*pOldSymbolSets, pOldSymbolSets->GetText(), false);
 }
 
@@ -1845,9 +1818,7 @@ IMPL_LINK_TYPED( SmSymDefineDialog, ModifyHdl, Edit&, rEdit, void )
 IMPL_LINK_TYPED( SmSymDefineDialog, FontChangeHdl, ListBox&, rListBox, void )
 {
     (void) rListBox;
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rListBox == pFonts, "Sm : wrong argument");
-#endif
+    assert(&rListBox == pFonts && "Sm : wrong argument");
 
     SelectFont(pFonts->GetSelectEntry());
 }
@@ -1870,9 +1841,7 @@ IMPL_LINK_NOARG_TYPED( SmSymDefineDialog, SubsetChangeHdl, ListBox&, void )
 IMPL_LINK_TYPED( SmSymDefineDialog, StyleChangeHdl, ComboBox&, rComboBox, void )
 {
     (void) rComboBox;
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pStyles, "Sm : falsches Argument");
-#endif
+    assert(&rComboBox == pStyles && "Sm : falsches Argument");
 
     SelectStyle(pStyles->GetText());
 }
@@ -1882,9 +1851,7 @@ IMPL_LINK_NOARG_TYPED(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void
 {
    sal_UCS4 cChar = pCharsetDisplay->GetSelectCharacter();
 
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE( pSubsetMap, "SubsetMap missing" );
-#endif
+    assert(pSubsetMap && "SubsetMap missing");
     if (pSubsetMap)
     {
         const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
@@ -1911,10 +1878,8 @@ IMPL_LINK_NOARG_TYPED(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void
 IMPL_LINK_TYPED( SmSymDefineDialog, AddClickHdl, Button *, pButton, void )
 {
     (void) pButton;
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(pButton == pAddBtn, "Sm : wrong argument");
-    OSL_ENSURE(pAddBtn->IsEnabled(), "Sm : requirements met ??");
-#endif
+    assert(pButton == pAddBtn && "Sm : wrong argument");
+    assert(pButton->IsEnabled() && "Sm : requirements met ??");
 
     // add symbol
     const SmSym aNewSymbol( pSymbols->GetText(), pCharsetDisplay->GetFont(),
@@ -1940,10 +1905,8 @@ IMPL_LINK_TYPED( SmSymDefineDialog, AddClickHdl, Button *, pButton, void )
 IMPL_LINK_TYPED( SmSymDefineDialog, ChangeClickHdl, Button *, pButton, void )
 {
     (void) pButton;
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(pButton == pChangeBtn, "Sm : wrong argument");
-    OSL_ENSURE(pChangeBtn->IsEnabled(), "Sm : requirements met ??");
-#endif
+    assert(pButton == pChangeBtn && "Sm : wrong argument");
+    assert(pChangeBtn->IsEnabled() && "Sm : requirements met ??");
 
     // get new Sybol to use
     //! get font from symbol-disp lay since charset-display does not keep
@@ -1979,10 +1942,8 @@ IMPL_LINK_TYPED( SmSymDefineDialog, ChangeClickHdl, Button *, pButton, void )
 IMPL_LINK_TYPED( SmSymDefineDialog, DeleteClickHdl, Button *, pButton, void )
 {
     (void) pButton;
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(pButton == pDeleteBtn, "Sm : wrong argument");
-    OSL_ENSURE(pDeleteBtn->IsEnabled(), "Sm : requirements met ??");
-#endif
+    assert(pButton == pDeleteBtn && "Sm : wrong argument");
+    assert(pDeleteBtn->IsEnabled() && "Sm : requirements met ??");
 
     if (pOrigSymbol)
     {
@@ -2177,10 +2138,7 @@ void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr)
 bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
         const OUString &rSymbolSetName, bool bDeleteText)
 {
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pOldSymbolSets  ||  &rComboBox == pSymbolSets,
-        "Sm : wrong ComboBox");
-#endif
+    assert((&rComboBox == pOldSymbolSets || &rComboBox == pSymbolSets) && "Sm : wrong ComboBox");
 
     // trim SymbolName (no leading and trailing blanks)
     OUString  aNormName (rSymbolSetName);
@@ -2255,10 +2213,7 @@ void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
 bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
         const OUString &rSymbolName, bool bDeleteText)
 {
-#if OSL_DEBUG_LEVEL > 1
-    OSL_ENSURE(&rComboBox == pOldSymbols  ||  &rComboBox == pSymbols,
-        "Sm : wrong ComboBox");
-#endif
+    assert((&rComboBox == pOldSymbols || &rComboBox == pSymbols) && "Sm : wrong ComboBox");
 
     // trim SymbolName (no blanks)
     OUString  aNormName(comphelper::string::remove(rSymbolName, ' '));
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 696a76a..9cb102e 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -252,12 +252,7 @@ void SmDocShell::ArrangeFormula()
     SmPrinterAccess  aPrtAcc(*this);
     OutputDevice* pOutDev = aPrtAcc.GetRefDev();
 
-    if (!pOutDev)
-    {
-#if OSL_DEBUG_LEVEL > 1
-        SAL_WARN( "starmath", "!! SmDocShell::ArrangeFormula: reference device missing !!");
-#endif
-    }
+    SAL_WARN_IF( !pOutDev, "starmath", "!! SmDocShell::ArrangeFormula: reference device missing !!");
 
     // if necessary get another OutputDevice for which we format
     if (!pOutDev)
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index c84abc8..509ddc4 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -205,9 +205,6 @@ SfxItemPool * SmEditWindow::GetEditEngineItemPool()
 void SmEditWindow::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg )
 {
     // Note: SetBackground still done in SmEditWindow::DataChanged
-#if OSL_DEBUG_LEVEL > 1
-//   ColorData nVal = rColorCfg.GetColorValue(svtools::FONTCOLOR).nColor;
-#endif
     SetTextColor( rColorCfg.GetColorValue(svtools::FONTCOLOR).nColor );
     Invalidate();
 }
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 94afcd5..8627958 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -581,16 +581,13 @@ bool MathType::Parse(SotStorage *pStor)
     //starmaths internals.
     rRet += "{}";
 
-#if OSL_DEBUG_LEVEL > 1
-#   ifdef CAOLAN
+#ifdef CAOLAN
     //sanity check
 
     //sigh, theres no point! MathType (in some bizarre subvarient) pads
     //the end of the formula with ENDs (0)'s
     sal_uLong nEnd = pS->Tell();
-    OSL_ENSURE(nEnd == pS->Seek(STREAM_SEEK_TO_END),
-        "Possibly unfully parsed formula");
-#   endif
+    SAL_WARN_IF(nEnd == pS->Seek(STREAM_SEEK_TO_END), "starmath", "Possibly unfully parsed formula");
 #endif
     return bRet;
 }
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index f5f5d91..1540599 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -311,7 +311,6 @@ const SmTokenTableEntry * SmParser::GetTokenTableEntry( const OUString &rName )
 }
 
 
-#if OSL_DEBUG_LEVEL > 1
 
 static const sal_Unicode aDelimiterTable[] =
 {
@@ -346,7 +345,6 @@ bool SmParser::IsDelimiter( const OUString &rTxt, sal_Int32 nPos )
     return bIsDelim;
 }
 
-#endif
 
 void SmParser::Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText )
 {
@@ -470,10 +468,7 @@ void SmParser::NextToken()
         m_aCurToken.nLevel     = 5;
         m_aCurToken.aText      = m_aBufferString.copy( nRealStart, n );
 
-#if OSL_DEBUG_LEVEL > 1
-        if (!IsDelimiter( m_aBufferString, aRes.EndPos ))
-            SAL_WARN( "starmath", "identifier really finished? (compatibility!)" );
-#endif
+        SAL_WARN_IF( !IsDelimiter( m_aBufferString, aRes.EndPos ), "starmath", "identifier really finished? (compatibility!)" );
     }
     else if (aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING)
     {
@@ -508,10 +503,7 @@ void SmParser::NextToken()
             m_aCurToken.nLevel     = 5;
             m_aCurToken.aText      = aName;
 
-#if OSL_DEBUG_LEVEL > 1
-            if (!IsDelimiter( m_aBufferString, aRes.EndPos ))
-                SAL_WARN( "starmath", "identifier really finished? (compatibility!)" );
-#endif
+            SAL_WARN_IF(!IsDelimiter(m_aBufferString, aRes.EndPos),"starmath", "identifier really finished? (compatibility!)");
         }
     }
     else if (aRes.TokenType == 0  &&  '_' == m_aBufferString[ nRealStart ])
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 39cad51..f17f976 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -143,9 +143,6 @@ void SmGraphicWindow::ApplyColorConfigValues(const svtools::ColorConfig &rColorC
 {
     // Note: SetTextColor not necessary since the nodes that
     // get painted have the color information.
-#if OSL_DEBUG_LEVEL > 1
-//   ColorData nVal = rColorCfg.GetColorValue(svtools::DOCCOLOR).nColor;
-#endif
     SetBackground(Color(static_cast<ColorData>(rColorCfg.GetColorValue(svtools::DOCCOLOR).nColor)));
 }
 
@@ -667,12 +664,6 @@ SmEditController::SmEditController(SmEditWindow &rSmEdit,
 }
 
 
-#if OSL_DEBUG_LEVEL > 1
-SmEditController::~SmEditController()
-{
-}
-#endif
-
 
 void SmEditController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
 {
@@ -878,12 +869,6 @@ SmCmdBoxWrapper::SmCmdBoxWrapper(vcl::Window *pParentWindow, sal_uInt16 nId,
     static_cast<SfxDockingWindow *>(GetWindow())->Initialize(pInfo);
 }
 
-#if OSL_DEBUG_LEVEL > 1
-SmCmdBoxWrapper::~SmCmdBoxWrapper()
-{
-}
-#endif
-
 struct SmViewShell_Impl
 {
     std::unique_ptr<sfx2::DocumentInserter> pDocInserter;


More information about the Libreoffice-commits mailing list