[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] FindAdv: Fix expression checking for 'int' as if it were bool
From:       Kornel Benko <kornel () lyx ! org>
Date:       2022-05-25 18:54:09
Message-ID: 20220525185409.11A0A280638 () lyx ! lyx ! org
[Download RAW message or body]

commit bf60c6106641db7b756dacfb560eabaf399fe154
Author: Kornel Benko <kornel@lyx.org>
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
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic