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

Takeshi Abe tabe at fixedpoint.jp
Fri Feb 19 11:43:39 UTC 2016


 starmath/source/accessibility.cxx |    8 +++---
 starmath/source/cfgitem.cxx       |   44 +++++++++++++++++++-------------------
 starmath/source/mathmlexport.cxx  |    2 -
 starmath/source/node.cxx          |    8 +++---
 starmath/source/unomodel.cxx      |   12 +++++-----
 starmath/source/view.cxx          |    2 -
 6 files changed, 38 insertions(+), 38 deletions(-)

New commits:
commit 75da70ccbf7946d3c8de2572d98c2f9cf534b751
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Feb 19 17:31:12 2016 +0900

    starmath: Avoid C-style cast
    
    Change-Id: I96efea344dc4ec5c1f20060bb51ea5e853113c9c
    Reviewed-on: https://gerrit.libreoffice.org/22497
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 1b61f14..06a46ef 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -265,7 +265,7 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getForeground()
 
     if (!pWin)
         throw RuntimeException();
-    return (sal_Int32) pWin->GetTextColor().GetColor();
+    return static_cast<sal_Int32>(pWin->GetTextColor().GetColor());
 }
 
 sal_Int32 SAL_CALL SmGraphicAccessible::getBackground()
@@ -281,7 +281,7 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getBackground()
         nCol = pWin->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
     else
         nCol = aWall.GetColor().GetColor();
-    return (sal_Int32) nCol;
+    return static_cast<sal_Int32>(nCol);
 }
 
 sal_Int32 SAL_CALL SmGraphicAccessible::getAccessibleChildCount()
@@ -1743,7 +1743,7 @@ sal_Int32 SAL_CALL SmEditAccessible::getForeground()
 
     if (!pWin)
         throw RuntimeException();
-    return (sal_Int32) pWin->GetTextColor().GetColor();
+    return static_cast<sal_Int32>(pWin->GetTextColor().GetColor());
 }
 
 sal_Int32 SAL_CALL SmEditAccessible::getBackground()
@@ -1759,7 +1759,7 @@ sal_Int32 SAL_CALL SmEditAccessible::getBackground()
         nCol = pWin->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
     else
         nCol = aWall.GetColor().GetColor();
-    return (sal_Int32) nCol;
+    return static_cast<sal_Int32>(nCol);
 }
 
 // XAccessibleContext
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index dc70029..75b2c63 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -158,11 +158,11 @@ SmFontFormat::SmFontFormat()
 SmFontFormat::SmFontFormat( const vcl::Font &rFont )
 {
     aName       = rFont.GetFamilyName();
-    nCharSet    = (sal_Int16) rFont.GetCharSet();
-    nFamily     = (sal_Int16) rFont.GetFamilyType();
-    nPitch      = (sal_Int16) rFont.GetPitch();
-    nWeight     = (sal_Int16) rFont.GetWeight();
-    nItalic     = (sal_Int16) rFont.GetItalic();
+    nCharSet    = static_cast<sal_Int16>(rFont.GetCharSet());
+    nFamily     = static_cast<sal_Int16>(rFont.GetFamilyType());
+    nPitch      = static_cast<sal_Int16>(rFont.GetPitch());
+    nWeight     = static_cast<sal_Int16>(rFont.GetWeight());
+    nItalic     = static_cast<sal_Int16>(rFont.GetItalic());
 }
 
 
@@ -170,11 +170,11 @@ const vcl::Font SmFontFormat::GetFont() const
 {
     vcl::Font aRes;
     aRes.SetFamilyName( aName );
-    aRes.SetCharSet( (rtl_TextEncoding) nCharSet );
-    aRes.SetFamily( (FontFamily) nFamily );
-    aRes.SetPitch( (FontPitch) nPitch );
-    aRes.SetWeight( (FontWeight) nWeight );
-    aRes.SetItalic( (FontItalic) nItalic );
+    aRes.SetCharSet( static_cast<rtl_TextEncoding>(nCharSet) );
+    aRes.SetFamily( static_cast<FontFamily>(nFamily) );
+    aRes.SetPitch( static_cast<FontPitch>(nPitch) );
+    aRes.SetWeight( static_cast<FontWeight>(nWeight) );
+    aRes.SetItalic( static_cast<FontItalic>(nItalic) );
     return aRes;
 }
 
@@ -695,27 +695,27 @@ void SmMathConfig::SaveFontFormatList()
         // CharSet
         pVal->Name  = aNodeNameDelim;
         pVal->Name += *pName++;
-        pVal->Value <<= (sal_Int16) aFntFmt.nCharSet; // 6.0 file-format GetSOStoreTextEncoding not needed
+        pVal->Value <<= static_cast<sal_Int16>(aFntFmt.nCharSet); // 6.0 file-format GetSOStoreTextEncoding not needed
         pVal++;
         // Family
         pVal->Name  = aNodeNameDelim;
         pVal->Name += *pName++;
-        pVal->Value <<= (sal_Int16) aFntFmt.nFamily;
+        pVal->Value <<= static_cast<sal_Int16>(aFntFmt.nFamily);
         pVal++;
         // Pitch
         pVal->Name  = aNodeNameDelim;
         pVal->Name += *pName++;
-        pVal->Value <<= (sal_Int16) aFntFmt.nPitch;
+        pVal->Value <<= static_cast<sal_Int16>(aFntFmt.nPitch);
         pVal++;
         // Weight
         pVal->Name  = aNodeNameDelim;
         pVal->Name += *pName++;
-        pVal->Value <<= (sal_Int16) aFntFmt.nWeight;
+        pVal->Value <<= static_cast<sal_Int16>(aFntFmt.nWeight);
         pVal++;
         // Italic
         pVal->Name  = aNodeNameDelim;
         pVal->Name += *pName++;
-        pVal->Value <<= (sal_Int16) aFntFmt.nItalic;
+        pVal->Value <<= static_cast<sal_Int16>(aFntFmt.nItalic);
         pVal++;
     }
     OSL_ENSURE( sal::static_int_cast<size_t>(pVal - pValues) == nCount * nSymbolProps, "properties missing" );
@@ -911,21 +911,21 @@ void SmMathConfig::SaveFormat()
     // StandardFormat/Textmode
     *pValue++ <<= pFormat->IsTextmode();
     // StandardFormat/GreekCharStyle
-    *pValue++ <<= (sal_Int16) pFormat->GetGreekCharStyle();
+    *pValue++ <<= static_cast<sal_Int16>(pFormat->GetGreekCharStyle());
     // StandardFormat/ScaleNormalBracket
     *pValue++ <<= pFormat->IsScaleNormalBrackets();
     // StandardFormat/HorizontalAlignment
-    *pValue++ <<= (sal_Int16) pFormat->GetHorAlign();
+    *pValue++ <<= static_cast<sal_Int16>(pFormat->GetHorAlign());
     // StandardFormat/BaseSize
-    *pValue++ <<= (sal_Int16) SmRoundFraction( Sm100th_mmToPts(
-                                    pFormat->GetBaseSize().Height() ) );
+    *pValue++ <<= static_cast<sal_Int16>(SmRoundFraction( Sm100th_mmToPts(
+                                    pFormat->GetBaseSize().Height() ) ));
 
     sal_uInt16 i;
     for (i = SIZ_BEGIN;  i <= SIZ_END;  ++i)
-        *pValue++ <<= (sal_Int16) pFormat->GetRelSize( i );
+        *pValue++ <<= static_cast<sal_Int16>(pFormat->GetRelSize( i ));
 
     for (i = DIS_BEGIN;  i <= DIS_END;  ++i)
-        *pValue++ <<= (sal_Int16) pFormat->GetDistance( i );
+        *pValue++ <<= static_cast<sal_Int16>(pFormat->GetDistance( i ));
 
     for (i = FNT_BEGIN;  i < FNT_END;  ++i)
     {
@@ -1162,7 +1162,7 @@ void SmMathConfig::ItemSetToConfig(const SfxItemSet &rSet)
     bool bVal;
     if (rSet.GetItemState(SID_PRINTSIZE, true, &pItem) == SfxItemState::SET)
     {   nU16 = static_cast<const SfxUInt16Item *>(pItem)->GetValue();
-        SetPrintSize( (SmPrintSize) nU16 );
+        SetPrintSize( static_cast<SmPrintSize>(nU16) );
     }
     if (rSet.GetItemState(SID_PRINTZOOM, true, &pItem) == SfxItemState::SET)
     {   nU16 = static_cast<const SfxUInt16Item *>(pItem)->GetValue();
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index b022c3a..b80af3f 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -86,7 +86,7 @@ sal_Unicode ConvertMathToMathML( sal_Unicode cChar )
     if (IsInPrivateUseArea( cChar ))
     {
         SAL_WARN("starmath", "Error: private use area characters should no longer be in use!" );
-        cRes = (sal_Unicode) '@'; // just some character that should easily be notice as odd in the context
+        cRes = sal_Unicode('@'); // just some character that should easily be notice as odd in the context
     }
     return cRes;
 }
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 7c16927..8bd1ca8 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -1158,12 +1158,12 @@ bool IsPointInLine(const Point &rPoint1,
     double fLambda;
     if (labs(rHeading2.X()) > labs(rHeading2.Y()))
     {
-        fLambda = (rPoint1.X() - rPoint2.X()) / (double) rHeading2.X();
+        fLambda = (rPoint1.X() - rPoint2.X()) / static_cast<double>(rHeading2.X());
         bRes = fabs(rPoint1.Y() - (rPoint2.Y() + fLambda * rHeading2.Y())) < eps;
     }
     else
     {
-        fLambda = (rPoint1.Y() - rPoint2.Y()) / (double) rHeading2.Y();
+        fLambda = (rPoint1.Y() - rPoint2.Y()) / static_cast<double>(rHeading2.Y());
         bRes = fabs(rPoint1.X() - (rPoint2.X() + fLambda * rHeading2.X())) < eps;
     }
 
@@ -2595,7 +2595,7 @@ SmMathSymbolNode::SmMathSymbolNode(const SmToken &rNodeToken)
 :   SmSpecialNode(NMATH, rNodeToken, FNT_MATH)
 {
     sal_Unicode cChar = GetToken().cMathChar;
-    if ((sal_Unicode) '\0' != cChar)
+    if (sal_Unicode('\0') != cChar)
         SetText(OUString(cChar));
 }
 
@@ -2815,7 +2815,7 @@ static bool lcl_IsFromGreekSymbolSet( const OUString &rTokenText )
     bool bRes = false;
 
     // valid symbol name needs to have a '%' at pos 0 and at least an additional char
-    if (rTokenText.getLength() > 2 && rTokenText[0] == (sal_Unicode)'%')
+    if (rTokenText.getLength() > 2 && rTokenText[0] == sal_Unicode('%'))
     {
         OUString aName( rTokenText.copy(1) );
         SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName );
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 07cf724..1fa7fe4 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -387,9 +387,9 @@ static sal_Int16 lcl_AnyToINT16(const uno::Any& rAny)
 
     sal_Int16 nRet = 0;
     if( eType == uno::TypeClass_DOUBLE )
-        nRet = (sal_Int16)*static_cast<double const *>(rAny.getValue());
+        nRet = static_cast<sal_Int16>(*static_cast<double const *>(rAny.getValue()));
     else if( eType == uno::TypeClass_FLOAT )
-        nRet = (sal_Int16)*static_cast<float const *>(rAny.getValue());
+        nRet = static_cast<sal_Int16>(*static_cast<float const *>(rAny.getValue()));
     else
         rAny >>= nRet;
     return nRet;
@@ -768,7 +768,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
             case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS     :
             case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS     :
             case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS        :
-                *pValue <<= (sal_Int16) aFormat.GetRelSize((*ppEntries)->mnMemberId);
+                *pValue <<= static_cast<sal_Int16>(aFormat.GetRelSize((*ppEntries)->mnMemberId));
             break;
 
             case HANDLE_IS_TEXT_MODE                       :
@@ -779,12 +779,12 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
             break;
 
             case HANDLE_GREEK_CHAR_STYLE                    :
-                *pValue <<= (sal_Int16)aFormat.GetGreekCharStyle();
+                *pValue <<= static_cast<sal_Int16>(aFormat.GetGreekCharStyle());
             break;
 
             case HANDLE_ALIGNMENT                          :
                 // SmHorAlign uses the same values as HorizontalAlignment
-                *pValue <<= (sal_Int16)aFormat.GetHorAlign();
+                *pValue <<= static_cast<sal_Int16>(aFormat.GetHorAlign());
             break;
 
             case HANDLE_RELATIVE_SPACING                   :
@@ -811,7 +811,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
             case HANDLE_RIGHT_MARGIN              :
             case HANDLE_TOP_MARGIN                :
             case HANDLE_BOTTOM_MARGIN             :
-                *pValue <<= (sal_Int16)aFormat.GetDistance((*ppEntries)->mnMemberId);
+                *pValue <<= static_cast<sal_Int16>(aFormat.GetDistance((*ppEntries)->mnMemberId));
             break;
             case HANDLE_IS_SCALE_ALL_BRACKETS              :
             {
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index f247fa8..2808448 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -146,7 +146,7 @@ void SmGraphicWindow::ApplyColorConfigValues(const svtools::ColorConfig &rColorC
 #if OSL_DEBUG_LEVEL > 1
 //   ColorData nVal = rColorCfg.GetColorValue(svtools::DOCCOLOR).nColor;
 #endif
-    SetBackground(Color( (ColorData) rColorCfg.GetColorValue(svtools::DOCCOLOR).nColor));
+    SetBackground(Color(static_cast<ColorData>(rColorCfg.GetColorValue(svtools::DOCCOLOR).nColor)));
 }
 
 


More information about the Libreoffice-commits mailing list