[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Feb 6 01:50:41 UTC 2019


 vcl/source/edit/texteng.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 697b73f4f421fd190070057aafb40a62005d3ba7
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jan 21 16:52:30 2019 +0100
Commit:     Aron Budea <aron.budea at collabora.com>
CommitDate: Wed Feb 6 02:48:53 2019 +0100

    Simplify nXWidth initialization
    
    ...which happens to avoid an unhelpful -Werror=strict-overflow with GCC 7 and
    --enable-optimized:
    
    > vcl/source/edit/texteng.cxx: In member function ‘bool TextEngine::CreateLines(sal_uInt32)’:
    > vcl/source/edit/texteng.cxx:2197:9: error: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Werror=strict-overflow]
    >          if ( nTmpWidth > nXWidth )
    >          ^~
    
    Change-Id: Ia87933da6e38b8b462d2ea34c3db6a84c5840f92
    Reviewed-on: https://gerrit.libreoffice.org/66690
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 41fded57629ce1c14d806c0f37c18540ad2cf613)

diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index e369e8299f9c..87ccc1d30c41 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2172,9 +2172,8 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
         std::size_t nTmpPortion = pLine->GetStartPortion();
         long nTmpWidth = mpDoc->GetLeftMargin();
         // do not subtract margin; it is included in TmpWidth
-        long nXWidth = mnMaxTextWidth ? mnMaxTextWidth : std::numeric_limits<long>::max();
-        if ( nXWidth < nTmpWidth )
-            nXWidth = nTmpWidth;
+        long nXWidth = std::max(
+            mnMaxTextWidth ? mnMaxTextWidth : std::numeric_limits<long>::max(), nTmpWidth);
 
         // search for Portion that does not fit anymore into line
         TETextPortion* pPortion = nullptr;


More information about the Libreoffice-commits mailing list