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

Takeshi Abe tabe at fixedpoint.jp
Tue Feb 2 12:25:57 UTC 2016


 starmath/inc/format.hxx     |    2 +-
 starmath/inc/node.hxx       |    6 +++---
 starmath/source/cfgitem.cxx |    4 ++--
 starmath/source/dialog.cxx  |   24 ++++++++++++------------
 starmath/source/node.cxx    |    2 +-
 starmath/source/rect.cxx    |    2 +-
 6 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 59aee037e3cf33b253b6f5ebafe3872e420d3408
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon Feb 1 18:36:48 2016 +0900

    starmath: Avoid C-style cast
    
    Change-Id: Ie8ae44e1b90796033847a892474f4de64e7f9328
    Reviewed-on: https://gerrit.libreoffice.org/21984
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx
index dccdded..af1b24a 100644
--- a/starmath/inc/format.hxx
+++ b/starmath/inc/format.hxx
@@ -26,7 +26,7 @@
 #include <types.hxx>
 
 
-#define SM_FMT_VERSION_51   ((sal_uInt8) 0x01)
+#define SM_FMT_VERSION_51   (sal_uInt8(0x01))
 #define SM_FMT_VERSION_NOW  SM_FMT_VERSION_51
 
 #define FNTNAME_TIMES   "Times New Roman"
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 90e7a57..1dc5201 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -165,8 +165,8 @@ public:
     sal_Int32       GetAccessibleIndex() const { return mnAccIndex; }
     const SmNode *  FindNodeWithAccessibleIndex(sal_Int32 nAccIndex) const;
 
-    sal_uInt16  GetRow() const    { return (sal_uInt16)maNodeToken.nRow; }
-    sal_uInt16  GetColumn() const { return (sal_uInt16)maNodeToken.nCol; }
+    sal_uInt16  GetRow() const    { return sal::static_int_cast<sal_uInt16>(maNodeToken.nRow); }
+    sal_uInt16  GetColumn() const { return sal::static_int_cast<sal_uInt16>(maNodeToken.nCol); }
 
     SmScaleMode     GetScaleMode() const { return meScaleMode; }
     void            SetScaleMode(SmScaleMode eMode) { meScaleMode = eMode; }
@@ -559,7 +559,7 @@ protected:
     :   SmSpecialNode(eNodeType, rNodeToken, FNT_MATH)
     {
         sal_Unicode cChar = GetToken().cMathChar;
-        if ((sal_Unicode) '\0' != cChar)
+        if (sal_Unicode('\0') != cChar)
             SetText(OUString(cChar));
     }
 
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 277f65e..313a33b 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -1220,9 +1220,9 @@ void SmMathConfig::ConfigToItemSet(SfxItemSet &rSet) const
     const SfxItemPool *pPool = rSet.GetPool();
 
     rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
-                           (sal_uInt16) GetPrintSize()));
+                           sal::static_int_cast<sal_uInt16>(GetPrintSize())));
     rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
-                           (sal_uInt16) GetPrintZoomFactor()));
+                           GetPrintZoomFactor()));
 
     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle()));
     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT),  IsPrintFormulaText()));
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 5dcbf81..9f02fda 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -218,7 +218,7 @@ bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet)
         nPrintSize = PRINT_SIZE_ZOOMED;
 
     rSet->Put(SfxUInt16Item(GetWhich(SID_PRINTSIZE), nPrintSize));
-    rSet->Put(SfxUInt16Item(GetWhich(SID_PRINTZOOM), (sal_uInt16) m_pZoom->GetValue()));
+    rSet->Put(SfxUInt16Item(GetWhich(SID_PRINTZOOM), sal::static_int_cast<sal_uInt16>(m_pZoom->GetValue())));
     rSet->Put(SfxBoolItem(GetWhich(SID_PRINTTITLE), m_pTitle->IsChecked()));
     rSet->Put(SfxBoolItem(GetWhich(SID_PRINTTEXT), m_pText->IsChecked()));
     rSet->Put(SfxBoolItem(GetWhich(SID_PRINTFRAME), m_pFrame->IsChecked()));
@@ -483,11 +483,11 @@ void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const
 {
     rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm( static_cast< long >(m_pBaseSize->GetValue()))) );
 
-    rFormat.SetRelSize(SIZ_TEXT,     (sal_uInt16) m_pTextSize->GetValue());
-    rFormat.SetRelSize(SIZ_INDEX,    (sal_uInt16) m_pIndexSize->GetValue());
-    rFormat.SetRelSize(SIZ_FUNCTION, (sal_uInt16) m_pFunctionSize->GetValue());
-    rFormat.SetRelSize(SIZ_OPERATOR, (sal_uInt16) m_pOperatorSize->GetValue());
-    rFormat.SetRelSize(SIZ_LIMITS,   (sal_uInt16) m_pBorderSize->GetValue());
+    rFormat.SetRelSize(SIZ_TEXT,     sal::static_int_cast<sal_uInt16>(m_pTextSize->GetValue()));
+    rFormat.SetRelSize(SIZ_INDEX,    sal::static_int_cast<sal_uInt16>(m_pIndexSize->GetValue()));
+    rFormat.SetRelSize(SIZ_FUNCTION, sal::static_int_cast<sal_uInt16>(m_pFunctionSize->GetValue()));
+    rFormat.SetRelSize(SIZ_OPERATOR, sal::static_int_cast<sal_uInt16>(m_pOperatorSize->GetValue()));
+    rFormat.SetRelSize(SIZ_LIMITS,   sal::static_int_cast<sal_uInt16>(m_pBorderSize->GetValue()));
 
     const Size aTmp (rFormat.GetBaseSize());
     for (sal_uInt16  i = FNT_BEGIN;  i <= FNT_END;  i++)
@@ -805,10 +805,10 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
     if (nActiveCategory != CATEGORY_NONE)
     {
         pCat = Categories[nActiveCategory];
-        pCat->SetValue(0, (sal_uInt16) m_pMetricField1->GetValue());
-        pCat->SetValue(1, (sal_uInt16) m_pMetricField2->GetValue());
-        pCat->SetValue(2, (sal_uInt16) m_pMetricField3->GetValue());
-        pCat->SetValue(3, (sal_uInt16) m_pMetricField4->GetValue());
+        pCat->SetValue(0, sal::static_int_cast<sal_uInt16>(m_pMetricField1->GetValue()));
+        pCat->SetValue(1, sal::static_int_cast<sal_uInt16>(m_pMetricField2->GetValue()));
+        pCat->SetValue(2, sal::static_int_cast<sal_uInt16>(m_pMetricField3->GetValue()));
+        pCat->SetValue(3, sal::static_int_cast<sal_uInt16>(m_pMetricField4->GetValue()));
 
         if (nActiveCategory == 5)
             bScaleAllBrackets = m_pCheckBox1->IsChecked();
@@ -1233,8 +1233,8 @@ void SmShowSymbolSetWindow::KeyInput(const KeyEvent& rKEvt)
         n = nSelectSymbol;
 
     // adjust scrollbar
-    if ((n < (sal_uInt16) (m_pVScrollBar->GetThumbPos() * nColumns)) ||
-        (n >= (sal_uInt16) ((m_pVScrollBar->GetThumbPos() + nRows) * nColumns)))
+    if ((n < sal::static_int_cast<sal_uInt16>(m_pVScrollBar->GetThumbPos() * nColumns)) ||
+        (n >= sal::static_int_cast<sal_uInt16>((m_pVScrollBar->GetThumbPos() + nRows) * nColumns)))
     {
         m_pVScrollBar->SetThumbPos(n / nColumns);
         Invalidate();
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index d7a1592..330b0fc 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -598,7 +598,7 @@ bool SmStructureNode::IsVisible() const
 
 sal_uInt16 SmStructureNode::GetNumSubNodes() const
 {
-    return (sal_uInt16) aSubNodes.size();
+    return sal::static_int_cast<sal_uInt16>(aSubNodes.size());
 }
 
 
diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx
index 4ca941a..e5e0696 100644
--- a/starmath/source/rect.cxx
+++ b/starmath/source/rect.cxx
@@ -227,7 +227,7 @@ SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat,
     OSL_ENSURE( nEBorderWidth >= 0, "BorderWidth is negative" );
     if (nEBorderWidth < 0)
         nEBorderWidth = 0;
-    Init(rDev, pFormat, rText, (sal_uInt16) nEBorderWidth);
+    Init(rDev, pFormat, rText, sal::static_int_cast<sal_uInt16>(nEBorderWidth));
 }
 
 


More information about the Libreoffice-commits mailing list