[Libreoffice-commits] core.git: 2 commits - formula/source include/svl sc/source svl/source

Eike Rathke erack at redhat.com
Wed Jun 8 20:49:29 UTC 2016


 formula/source/core/api/FormulaCompiler.cxx |    9 ++++++---
 include/svl/zforlist.hxx                    |    2 +-
 sc/source/core/data/column.cxx              |    2 +-
 svl/source/numbers/numfmuno.cxx             |    9 +--------
 svl/source/numbers/zforlist.cxx             |    6 +++---
 5 files changed, 12 insertions(+), 16 deletions(-)

New commits:
commit 91640c080c7a0643cce95f605ca7774da4c4dd77
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jun 8 21:22:34 2016 +0200

    make SvNumberFormatter::IsCompatible() static
    
    Change-Id: Ic40d0852c8e0a8f0957fc782c85c1084c7fe265f

diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index d87641e4..1fdb306 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -339,7 +339,7 @@ public:
     LanguageType GetLanguage() const;
 
     // Determine whether two format types are input compatible or not
-    bool IsCompatible(short eOldType, short eNewType);
+    static bool IsCompatible(short eOldType, short eNewType);
 
     /** Get table of formats of a specific type of a locale. A format FIndex is
         tested whether it has the type and locale requested, if it doesn't
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 548efca..4013208 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -524,7 +524,7 @@ void ScColumn::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
             nRow1, nRow2, nRow );
         sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter );
         short nOldType = pFormatter->GetType( nFormat );
-        if ( nOldType == nNewType || pFormatter->IsCompatible( nOldType, nNewType ) )
+        if ( nOldType == nNewType || SvNumberFormatter::IsCompatible( nOldType, nNewType ) )
             nRow = nRow2;
         else
         {
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 0f87d68..0047c34 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -622,14 +622,7 @@ sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    bool bRet = false;
-    SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
-        bRet = pFormatter->IsCompatible( nOldType, nNewType );
-    else
-        throw uno::RuntimeException();
-
-    return bRet;
+    return SvNumberFormatter::IsCompatible( nOldType, nNewType );
 }
 
 sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale )
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 0747e0c..9cfe4cc 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1146,8 +1146,8 @@ LanguageType SvNumberFormatter::GetLanguage() const
     return IniLnge;
 }
 
-bool SvNumberFormatter::IsCompatible(short eOldType,
-                                     short eNewType)
+// static
+bool SvNumberFormatter::IsCompatible(short eOldType, short eNewType)
 {
     if (eOldType == eNewType)
     {
@@ -1168,9 +1168,9 @@ bool SvNumberFormatter::IsCompatible(short eOldType,
             case css::util::NumberFormat::CURRENCY:
             case css::util::NumberFormat::SCIENTIFIC:
             case css::util::NumberFormat::FRACTION:
-//          case css::util::NumberFormat::LOGICAL:
             case css::util::NumberFormat::DEFINED:
                 return true;
+            case css::util::NumberFormat::LOGICAL:
             default:
                 return false;
             }
commit 333b644d112d94e3d675e5915b8b1e535b0841e4
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jun 8 18:25:52 2016 +0200

    assert on "forgot to add a jump" for OpCode
    
    Change-Id: I6c430b8a4079cd0d74e5c9e71a3f7b5b638d4ef5

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index ffd0f89..2f641b2 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1547,7 +1547,8 @@ void FormulaCompiler::Factor()
                     pFacToken->GetJump()[ 0 ] = 2;  // if, behind
                     break;
                 default:
-                    SAL_WARN( "formula.core", "FormulaCompiler::Factor: forgot to add a jump count case?");
+                    SAL_WARN("formula.core","Jump OpCode: " << eOp);
+                    assert(!"FormulaCompiler::Factor: someone forgot to add a jump count case");
             }
             eOp = NextToken();
             if (eOp == ocOpen)
@@ -1579,7 +1580,8 @@ void FormulaCompiler::Factor()
                     break;
                 default:
                     nJumpMax = 0;
-                    SAL_WARN( "formula.core", "FormulaCompiler::Factor: forgot to add a jump max case?");
+                    SAL_WARN("formula.core","Jump OpCode: " << eFacOpCode);
+                    assert(!"FormulaCompiler::Factor: someone forgot to add a jump max case");
             }
             short nJumpCount = 0;
             while ( (nJumpCount < (FORMULA_MAXJUMPCOUNT - 1)) && (eOp == ocSep)
@@ -1617,7 +1619,8 @@ void FormulaCompiler::Factor()
                         break;
                     default:
                         bLimitOk = false;
-                        SAL_WARN( "formula.core", "FormulaCompiler::Factor: forgot to add a jump limit case?");
+                        SAL_WARN("formula.core","Jump OpCode: " << eFacOpCode);
+                        assert(!"FormulaCompiler::Factor: someone forgot to add a jump limit case");
                 }
                 if (bLimitOk)
                     pFacToken->GetJump()[ 0 ] = nJumpCount;


More information about the Libreoffice-commits mailing list