diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-21 16:52:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-21 19:08:49 +0100 |
commit | 41fded57629ce1c14d806c0f37c18540ad2cf613 (patch) | |
tree | 075c4785af633efe425852812a374035b970753a /vcl/source | |
parent | 15819181772d95963d16c1c2eaa9e51af81f7f68 (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.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index c4402d48924b..2c8e320468b0 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -2148,9 +2148,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; |