commit bf60c6106641db7b756dacfb560eabaf399fe154
Author: Kornel Benko <[email protected]>
Date: Wed May 25 21:34:17 2022 +0200
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)'
---
src/lyxfind.cpp | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 3963c96..ac6366c 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -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
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs