]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.cpp
Cmake build: Project names *should* be uniq
[lyx.git] / src / lyxfind.cpp
index d531e9a6c65f3e605cdf57bf6148922a3b5a5116..441cbf18b3c0cf0396ce56d60b3944e9345e1748 100644 (file)
@@ -978,24 +978,26 @@ int MatchStringAdv::findAux(DocIterator const & cur, int len, bool at_begin) con
                // due to close wildcards added at end of regexp
                if (close_wildcards == 0)
                        return m[0].second - m[0].first;
-               else
-                       return m[m.size() - close_wildcards].first - m[0].first;
+
+               return m[m.size() - close_wildcards].first - m[0].first;
+       }
+
+       // else !use_regexp: but all code paths above return
+       LYXERR(Debug::FIND, "Searching in normal mode: par_as_string='"
+                                << par_as_string << "', str='" << str << "'");
+       LYXERR(Debug::FIND, "Searching in normal mode: lead_as_string='"
+                                << lead_as_string << "', par_as_string_nolead='"
+                                << par_as_string_nolead << "'");
+
+       if (at_begin) {
+               LYXERR(Debug::FIND, "size=" << par_as_string.size()
+                                        << ", substr='" << str.substr(0, par_as_string.size()) << "'");
+               if (str.substr(0, par_as_string.size()) == par_as_string)
+                       return par_as_string.size();
        } else {
-               LYXERR(Debug::FIND, "Searching in normal mode: par_as_string='" 
-                      << par_as_string << "', str='" << str << "'");
-               LYXERR(Debug::FIND, "Searching in normal mode: lead_as_string='" 
-                      << lead_as_string << "', par_as_string_nolead='" 
-                      << par_as_string_nolead << "'");
-               if (at_begin) {
-                       LYXERR(Debug::FIND, "size=" << par_as_string.size() 
-                              << ", substr='" << str.substr(0, par_as_string.size()) << "'");
-                       if (str.substr(0, par_as_string.size()) == par_as_string)
-                               return par_as_string.size();
-               } else {
-                       size_t pos = str.find(par_as_string_nolead);
-                       if (pos != string::npos)
-                               return par_as_string.size();
-               }
+               size_t pos = str.find(par_as_string_nolead);
+               if (pos != string::npos)
+                       return par_as_string.size();
        }
        return 0;
 }
@@ -1474,8 +1476,9 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M
                LYXERR(Debug::FIND, "Latexified replace_buffer: '" << repl_latex << "'");
                string s;
                // false positive from coverity
-               // coverity[CHECKED_RETURN]
+               // coverity[check_return]
                regex_replace(to_utf8(repl_latex), s, "\\$(.*)\\$", "$1");
+               // coverity[check_return]
                regex_replace(s, s, "\\\\\\[(.*)\\\\\\]", "$1");
                repl_latex = from_utf8(s);
                LYXERR(Debug::FIND, "Replacing by insert()ing latex: '" << repl_latex << "' cur=" << cur << " with depth=" << cur.depth());