starmath/source/mathmlexport.cxx |   52 +++++++++++++++------------------------
 starmath/source/mathtype.cxx     |    8 +++---
 2 files changed, 24 insertions(+), 36 deletions(-)

New commits:
commit ea62885a4f759dfb5a7236e9ac3a69da4703e902
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Oct 28 03:04:53 2018 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Oct 28 07:56:46 2018 +0100

    tdf#120703 PVS: V547 Expression is always true/false
    
    Change-Id: Ieb48a5fd29f78d2e39e1d91448f3ce973aff93d9
    Reviewed-on: https://gerrit.libreoffice.org/62463
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 9c4af5cef2e8..d8924c95cb30 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -545,40 +545,28 @@ void SmXMLExport::GetConfigurationSettings( Sequence < 
PropertyValue > & rProps)
         if (xPropertySetInfo.is())
         {
             Sequence< Property > aProps = xPropertySetInfo->getProperties();
-            sal_Int32 nCount(aProps.getLength());
-            if (nCount > 0)
+            if (const sal_Int32 nCount = aProps.getLength())
             {
                 rProps.realloc(nCount);
-                PropertyValue* pProps = rProps.getArray();
-                if (pProps)
-                {
-                    SmMathConfig *pConfig = SM_MOD()->GetConfig();
-                    const bool bUsedSymbolsOnly = pConfig && 
pConfig->IsSaveOnlyUsedSymbols();
-
-                    const OUString sFormula ( "Formula" );
-                    const OUString sBasicLibraries ( "BasicLibraries" );
-                    const OUString sDialogLibraries ( "DialogLibraries" );
-                    const OUString sRuntimeUID ( "RuntimeUID" );
-                    for (sal_Int32 i = 0; i < nCount; i++, pProps++)
-                    {
-                        const OUString &rPropName = aProps[i].Name;
-                        if (rPropName != sFormula &&
-                            rPropName != sBasicLibraries &&
-                            rPropName != sDialogLibraries &&
-                            rPropName != sRuntimeUID)
-                        {
-                            pProps->Name = rPropName;
-
-                            OUString aActualName( rPropName );
-
-                            // handle 'save used symbols only'
-                            if (bUsedSymbolsOnly && rPropName == "Symbols" )
-                                aActualName = "UserDefinedSymbolsInUse";
-
-                            pProps->Value = xProps->getPropertyValue( 
aActualName );
-                        }
-                    }
-                }
+                SmMathConfig* pConfig = SM_MOD()->GetConfig();
+                const bool bUsedSymbolsOnly = pConfig && 
pConfig->IsSaveOnlyUsedSymbols();
+
+                std::transform(aProps.begin(), aProps.end(), rProps.begin(),
+                               [bUsedSymbolsOnly, &xProps](Property& prop) {
+                                   PropertyValue aRet;
+                                   if (prop.Name != "Formula" && prop.Name != 
"BasicLibraries"
+                                       && prop.Name != "DialogLibraries"
+                                       && prop.Name != "RuntimeUID")
+                                   {
+                                       aRet.Name = prop.Name;
+                                       OUString aActualName(prop.Name);
+                                       // handle 'save used symbols only'
+                                       if (bUsedSymbolsOnly && prop.Name == 
"Symbols")
+                                           aActualName = 
"UserDefinedSymbolsInUse";
+                                       aRet.Value = 
xProps->getPropertyValue(aActualName);
+                                   }
+                                   return aRet;
+                               });
             }
         }
     }
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 9bd8c4e69ed7..dd44d32d332f 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -745,9 +745,9 @@ bool MathType::HandleRecords(int nLevel, sal_uInt8 
nSelector,
                                 rRet.append(" \\ldline ");
                             break;
                         case tmFLOOR:
-                            if (nVariation == 0 || nVariation == 1)
+                            if (nVariation == 0 || nVariation & 0x01) // 
tvFENCE_L
                                 rRet.append(" left lfloor ");
-                            else if (nVariation==1)
+                            else
                                 rRet.append(" left none ");
                             break;
                         case tmCEILING:
@@ -1286,9 +1286,9 @@ bool MathType::HandleRecords(int nLevel, sal_uInt8 
nSelector,
                                 rRet.append(" \\rdline ");
                             break;
                         case tmFLOOR:
-                            if (nVariation == 0 || nVariation == 2)
+                            if (nVariation == 0 || nVariation & 0x02) // 
tvFENCE_R
                                 rRet.append(" right rfloor ");
-                            else if (nVariation==2)
+                            else
                                 rRet.append(" right none ");
                             break;
                         case tmCEILING:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to