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

Miklos Vajna vmiklos at collabora.co.uk
Mon Nov 7 07:03:57 UTC 2016


 basic/source/sbx/sbxbyte.cxx |    6 +++---
 basic/source/sbx/sbxchar.cxx |    8 ++++----
 basic/source/sbx/sbxconv.hxx |   13 -------------
 basic/source/sbx/sbxint.cxx  |   14 +++++++-------
 basic/source/sbx/sbxlng.cxx  |    8 ++++----
 5 files changed, 18 insertions(+), 31 deletions(-)

New commits:
commit f996a5a153e1b7ff81d9343eedee244e585ecab9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Nov 7 08:03:01 2016 +0100

    basic: fix Android build
    
    rtl::math::round() is fine here, I guess.
    
    Change-Id: I4d92bc191182ff531e11d20ef87c69dc99da2b32

diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index 562979b..9d52eeb 100644
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -21,7 +21,7 @@
 #include <basic/sbx.hxx>
 #include "sbxconv.hxx"
 
-#include <cmath>
+#include <rtl/math.hxx>
 
 sal_uInt8 ImpGetByte( const SbxValues* p )
 {
@@ -123,7 +123,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
             }
             else
-                nRes = (sal_uInt8) std::lround( p->nSingle );
+                nRes = (sal_uInt8) rtl::math::round( p->nSingle );
             break;
         case SbxDATE:
         case SbxDOUBLE:
@@ -149,7 +149,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
             }
             else
-                nRes = (sal_uInt8) std::lround( dVal );
+                nRes = (sal_uInt8) rtl::math::round( dVal );
             break;
             }
         case SbxBYREF | SbxSTRING:
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index 81d195c..478a9d5 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -21,7 +21,7 @@
 #include <basic/sbx.hxx>
 #include "sbxconv.hxx"
 
-#include <cmath>
+#include <rtl/math.hxx>
 
 sal_Unicode ImpGetChar( const SbxValues* p )
 {
@@ -111,7 +111,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINCHAR;
             }
             else
-                nRes = (sal_Unicode) std::lround( p->nSingle );
+                nRes = (sal_Unicode) rtl::math::round( p->nSingle );
             break;
         case SbxDATE:
         case SbxDOUBLE:
@@ -137,7 +137,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINCHAR;
             }
             else
-                nRes = (sal_uInt8) std::lround( dVal );
+                nRes = (sal_uInt8) rtl::math::round( dVal );
             break;
             }
         case SbxBYREF | SbxSTRING:
@@ -158,7 +158,7 @@ start:
                     SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINCHAR;
                 }
                 else
-                    nRes = (sal_Unicode) std::lround( d );
+                    nRes = (sal_Unicode) rtl::math::round( d );
             }
             break;
         case SbxOBJECT:
diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx
index 34a9ba3..08fa296 100644
--- a/basic/source/sbx/sbxconv.hxx
+++ b/basic/source/sbx/sbxconv.hxx
@@ -21,19 +21,6 @@
 #define INCLUDED_BASIC_SOURCE_SBX_SBXCONV_HXX
 
 #include "sbxdec.hxx"
-#if defined(ANDROID)
-namespace std
-{
-double lround(double d)
-{
-    return d + ( d < 0 ? -0.5 : 0.5 );
-}
-double llround(double d)
-{
-    return d + ( d < 0 ? -0.5 : 0.5 );
-}
-}
-#endif
 
 class SbxArray;
 
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index b3d4cd3..41886a6 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -21,7 +21,7 @@
 #include <basic/sbx.hxx>
 #include "sbxconv.hxx"
 
-#include <cmath>
+#include <rtl/math.hxx>
 
 sal_Int16 ImpGetInteger( const SbxValues* p )
 {
@@ -81,7 +81,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMININT;
             }
             else
-                nRes = (sal_Int16) std::lround( p->nSingle );
+                nRes = (sal_Int16) rtl::math::round( p->nSingle );
             break;
         case SbxCURRENCY:
             {
@@ -142,7 +142,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMININT;
             }
             else
-                nRes = (sal_Int16) std::lround( dVal );
+                nRes = (sal_Int16) rtl::math::round( dVal );
             break;
             }
         case SbxLPSTR:
@@ -165,7 +165,7 @@ start:
                     SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMININT;
                 }
                 else
-                    nRes = (sal_Int16) std::lround( d );
+                    nRes = (sal_Int16) rtl::math::round( d );
             }
             break;
         case SbxOBJECT:
@@ -347,7 +347,7 @@ sal_Int64 ImpDoubleToSalInt64( double d )
         SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINSALINT64;
     }
     else
-        nRes = (sal_Int64) std::llround( d );
+        nRes = (sal_Int64) rtl::math::round( d );
     return nRes;
 }
 
@@ -363,7 +363,7 @@ sal_uInt64 ImpDoubleToSalUInt64( double d )
         SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
     }
     else
-        nRes = (sal_uInt64) std::llround( d );
+        nRes = (sal_uInt64) rtl::math::round( d );
     return nRes;
 }
 
@@ -713,7 +713,7 @@ start:
                         SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
                     }
                     else
-                        nRes = (sal_uInt64) std::llround( d );
+                        nRes = (sal_uInt64) rtl::math::round( d );
                 }
                 else if( n64 < 0 )
                 {
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index a5fcbad..73f503d 100644
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -21,7 +21,7 @@
 #include <basic/sbx.hxx>
 #include "sbxconv.hxx"
 
-#include <cmath>
+#include <rtl/math.hxx>
 
 sal_Int32 ImpGetLong( const SbxValues* p )
 {
@@ -65,7 +65,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINLNG;
             }
             else
-                nRes = (sal_Int32) std::lround( p->nSingle );
+                nRes = (sal_Int32) rtl::math::round( p->nSingle );
             break;
         case SbxSALINT64:
             nRes = p->nInt64;
@@ -106,7 +106,7 @@ start:
                 SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINLNG;
             }
             else
-                nRes = (sal_Int32) std::lround( dVal );
+                nRes = (sal_Int32) rtl::math::round( dVal );
             break;
             }
         case SbxBYREF | SbxSTRING:
@@ -129,7 +129,7 @@ start:
                     SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINLNG;
                 }
                 else
-                    nRes = (sal_Int32) std::lround( d );
+                    nRes = (sal_Int32) rtl::math::round( d );
             }
             break;
         case SbxOBJECT:


More information about the Libreoffice-commits mailing list