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

Mike Kaganski mike.kaganski at collabora.com
Wed Jan 31 20:02:17 UTC 2018


 basic/source/comp/codegen.cxx |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 7a42f3966378d5a43193e3d6db6f27bc319c3616
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Wed Jan 31 10:05:57 2018 +0300

    basic: MSVC: pragma warning: make more specific, remove obsolete
    
    Change-Id: I9e157f7b27eab831c5c15f6c22b9ffb20207b593
    Reviewed-on: https://gerrit.libreoffice.org/48947
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 8b7a0a8142e4..bcab0d0a0f95 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -468,19 +468,13 @@ public:
     virtual void end() override {}
     S offset()
     {
+        typedef decltype(T(1) + S(1)) larger_t; // type capable to hold both value ranges of T and S
         T result = 0 ;
         static const S max = std::numeric_limits< S >::max();
         result = m_nNumOp0 + ( ( sizeof(S) + 1 ) * m_nNumSingleParams ) + ( (( sizeof(S) * 2 )+ 1 )  * m_nNumDoubleParams );
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning( disable : 4309)
-#endif
-        return std::min(static_cast<T>(max), result);
-#ifdef _MSC_VER
-#pragma warning(push)
-#endif
+        return std::min<larger_t>(max, result);
     }
-   virtual bool processParams() override { return false; }
+    virtual bool processParams() override { return false; }
 };
 
 


More information about the Libreoffice-commits mailing list