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

Stephan Bergmann sbergman at redhat.com
Thu Feb 1 14:08:00 UTC 2018


 sw/source/core/text/itratr.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit c35d44ff72eb00c9f572870734e4d1832e8d9a5e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Feb 1 11:33:05 2018 +0100

    Use std::max
    
    (with the nice side-effect of removing one more false -Wsign-compare from
    Android builds where USHRT_MAX is erroneously of type unsigned int)
    
    (the original cast of rMax (of some unsigned type) to (signed) long had
    probably originally been added to silence some signed-vs.-unsigned comparison
    warning, so would no longer be necessary when using std::max)
    
    Change-Id: I26212e731e26d885b848c7351a9ca5f9735e1f78
    Reviewed-on: https://gerrit.libreoffice.org/49081
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 10fb397e3092..baf09a0f30fa 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <algorithm>
+
 #include <hintids.hxx>
 #include <editeng/charscaleitem.hxx>
 #include <txtatr.hxx>
@@ -694,8 +698,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
                                 // It were cleaner and maybe necessary later on to iterate over the content
                                 // of the text frame and call GetMinMaxSize recursively
                                 nAktWidth = FLYINCNT_MIN_WIDTH; // 0.5 cm
-                                if( static_cast<long>(rMax) < USHRT_MAX )
-                                    rMax = USHRT_MAX;
+                                rMax = std::max(rMax, sal_uLong(USHRT_MAX));
                             }
                             else
                                 nAktWidth = pFrameFormat->GetFrameSize().GetWidth();


More information about the Libreoffice-commits mailing list