sw/source/filter/ww8/wrtw8nds.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
New commits: commit da75e4750ec0d85aff72d9b7bf47289915488ab2 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Sep 23 07:39:25 2024 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Sep 23 08:43:35 2024 +0200 Simplify a bit Change-Id: I7d889137af443139e9a411a57c9bbaeb1af72ed2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173787 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 110d05e97327..513b3c50ebb2 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -257,16 +257,16 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTextNode& rTextNd) : m_nCurrentSwPos = SearchNext(1); } -static sal_Int32 lcl_getMinPos( sal_Int32 pos1, sal_Int32 pos2 ) +static bool pos_less( sal_Int32 pos1, sal_Int32 pos2 ) { if ( pos1 >= 0 && pos2 >= 0 ) { // both valid: return minimum one - return std::min(pos1, pos2); + return pos1 < pos2; } // return the valid one, if any, or -1 - return std::max(pos1, pos2); + return pos1 > pos2; } sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos ) @@ -289,9 +289,8 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos ) ++formElementPos; // tdf#133604 put this in its own run } - const sal_Int32 pos = lcl_getMinPos( - lcl_getMinPos(lcl_getMinPos(fieldEndPos, fieldSepPos), fieldStartPos), - formElementPos ); + const sal_Int32 pos + = std::min({ fieldEndPos, fieldSepPos, fieldStartPos, formElementPos }, pos_less); sal_Int32 nMinPos = (pos>=0) ? pos : SAL_MAX_INT32;