FindAdv: Fix expression checking for 'int' as if it were bool

Since the element 'match_len' in class MatchResult is an integer,
the check 'if (!match(...).match_len))' is changed to
'if (match(...).match_len) <= 0)'
This commit is contained in:
Kornel Benko 2022-05-25 21:34:17 +02:00
parent df82386ce6
commit bf60c61066

View File

@ -4566,7 +4566,8 @@ MatchResult findMostBackwards(DocIterator & cur, MatchStringAdv const & match, M
LYXERR(Debug::FINDVERBOSE, "findMostBackwards(): cur=" << cur);
DocIterator new_cur = cur;
new_cur.backwardPos();
if (new_cur == cur || &new_cur.inset() != &inset || !match(new_cur, -1, MatchStringAdv::MatchFromStart).match_len)
if (new_cur == cur || &new_cur.inset() != &inset
|| match(new_cur, -1, MatchStringAdv::MatchFromStart).match_len <= 0)
break;
MatchResult new_mr = findAdvFinalize(new_cur, match, expected);
if (new_mr.match_len == mr.match_len)
@ -4764,7 +4765,7 @@ static int findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, Ma
return 0;
LASSERT(sel_len > 0, return 0);
if (!matchAdv(sel_beg, sel_len, MatchStringAdv::MatchFromStart).match_len)
if (matchAdv(sel_beg, sel_len, MatchStringAdv::MatchFromStart).match_len <= 0)
return 0;
// Build a copy of the replace buffer, adapted to the KeepCase option