summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-01-21 16:52:30 +0100
committerAndras Timar <andras.timar@collabora.com>2019-10-06 18:56:44 +0200
commit825d8a5f8e4289ae895742901a36a419ad1c651e (patch)
treeb0e5c663bf1072c120059b5daa62cef8e86d0847 /vcl/source
parent297263e0cc5aa4b2b66fdc3fd17a725b9bc5fa42 (diff)
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@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/edit/texteng.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 859468fd9861..47ed32960866 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2146,9 +2146,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;