[Libreoffice-commits] core.git: 2 commits - external/liblangtag sc/source

Maarten Bosmans mkbosmans at gmail.com
Fri Sep 23 10:39:37 UTC 2016


 external/liblangtag/ExternalPackage_liblangtag_data.mk |    1 
 sc/source/core/inc/interpre.hxx                        |    1 
 sc/source/core/tool/interpr4.cxx                       |   38 ++++-------------
 3 files changed, 13 insertions(+), 27 deletions(-)

New commits:
commit 463843656731758f7e9292c03ab85b302e4bba0d
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Tue Sep 20 20:52:52 2016 +0200

    Factor out common ScInterpreter::GetInt32() code
    
    This might also be slightly more efficient because for
    GetInt32WithDefault() when the value is missing, the
    default value is not converted to and from double anymore.
    
    Change-Id: I0a234265273086824f749b04aba022dd5cef322f
    Reviewed-on: https://gerrit.libreoffice.org/29203
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index f076c54..296ad4b 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -411,6 +411,7 @@ double GetDoubleFromMatrix(const ScMatrixRef& pMat);
 double GetDouble();
 double GetDoubleWithDefault(double nDefault);
 bool IsMissing();
+sal_Int32 double_to_int32(double fVal);
 /** if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */
 sal_Int32 GetInt32();
 /** if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index d94c74c..174eeb0 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2146,9 +2146,8 @@ double ScInterpreter::GetDoubleWithDefault(double nDefault)
     return nResultVal;
 }
 
-sal_Int32 ScInterpreter::GetInt32()
+sal_Int32 ScInterpreter::double_to_int32(double fVal)
 {
-    double fVal = GetDouble();
     if (!rtl::math::isFinite(fVal))
     {
         SetError( GetDoubleErrorValue( fVal));
@@ -2175,33 +2174,18 @@ sal_Int32 ScInterpreter::GetInt32()
     return static_cast<sal_Int32>(fVal);
 }
 
+sal_Int32 ScInterpreter::GetInt32()
+{
+    return double_to_int32(GetDouble());
+}
+
 sal_Int32 ScInterpreter::GetInt32WithDefault( sal_Int32 nDefault )
 {
-    double fVal = GetDoubleWithDefault( nDefault);
-    if (!rtl::math::isFinite(fVal))
-    {
-        SetError( GetDoubleErrorValue( fVal));
-        return SAL_MAX_INT32;
-    }
-    if (fVal > 0.0)
-    {
-        fVal = rtl::math::approxFloor( fVal);
-        if (fVal > SAL_MAX_INT32)
-        {
-            SetError( errIllegalArgument);
-            return SAL_MAX_INT32;
-        }
-    }
-    else if (fVal < 0.0)
-    {
-        fVal = rtl::math::approxCeil( fVal);
-        if (fVal < SAL_MIN_INT32)
-        {
-            SetError( errIllegalArgument);
-            return SAL_MAX_INT32;
-        }
-    }
-    return static_cast<sal_Int32>(fVal);
+    bool bMissing = IsMissing();
+    double fVal = GetDouble();
+    if ( bMissing )
+        return nDefault;
+    return double_to_int32(fVal);
 }
 
 sal_Int16 ScInterpreter::GetInt16()
commit 680b1b5976197e378b091c9f9abeb5d33c6ede5c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 23 12:29:59 2016 +0200

    liblangtag: stop whining about missing supplementalMetadata.xml
    
    A good way to get developers to add files is to print 80 lines of
    stack trace multiple times on startup.
    
    Change-Id: Id563ab1d26d32e6fe3f14b2afb59949ea04f0d6a

diff --git a/external/liblangtag/ExternalPackage_liblangtag_data.mk b/external/liblangtag/ExternalPackage_liblangtag_data.mk
index d1468e2..c879bd2 100644
--- a/external/liblangtag/ExternalPackage_liblangtag_data.mk
+++ b/external/liblangtag/ExternalPackage_liblangtag_data.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,liblangtag_data,$(LIBO_SHARE
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,liblangtag_data,$(LIBO_SHARE_FOLDER)/liblangtag/common/supplemental,\
 	data/common/supplemental/likelySubtags.xml \
+	data/common/supplemental/supplementalMetadata.xml \
 ))
 
 # vim: set shiftwidth=4 tabstop=4 noexpandtab:


More information about the Libreoffice-commits mailing list