From cdf1521258ae618c0f42b8a339551495aa0d2003 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Wed, 2 Sep 2015 17:06:19 +0300 Subject: [PATCH 1/3] Further fix search replace --- lib/errorlogger.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 3b102ba17..f0f441f1e 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -302,14 +302,7 @@ void ErrorLogger::ErrorMessage::findAndReplace(std::string &source, const std::s std::string::size_type index = 0; while ((index = source.find(searchFor, index)) != std::string::npos) { source.replace(index, searchFor.length(), replaceWith); - - std::string::size_type advanceBy; - if (searchFor.length() >= replaceWith.length()) - advanceBy = replaceWith.length(); - else - advanceBy = (replaceWith.length() - searchFor.length()) + 1; - - index += advanceBy; + index += replaceWith.length(); } } From 92d3510de49b5bbdaaab077abede03303d8024f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 3 Sep 2015 08:26:47 +0200 Subject: [PATCH 2/3] std.cfg: Removed true that was added in the previous commit by library editor --- cfg/std.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 841f7a1ab..0ebb949a5 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -85,7 +85,6 @@ - true @@ -2727,14 +2726,12 @@ - true - true From 0f073ad27e2c73d69517725d7f864d08ecab22ee Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 3 Sep 2015 13:09:57 +0300 Subject: [PATCH 3/3] Quick check to omit useless heavy matches --- lib/checkother.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index d2adeb0d3..054f1cdb5 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2156,6 +2156,9 @@ void CheckOther::checkSignOfUnsignedVariable() const Scope * scope = symbolDatabase->functionScopes[i]; // check all the code in the function for (const Token *tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) { + // Quick check to see if any of the matches below have any chances + if (!tok->varId() && tok->str() != "0") + continue; if (Token::Match(tok, "%name% <|<= 0") && tok->varId() && !Token::Match(tok->tokAt(3), "+|-")) { // TODO: handle a[10].b , a::b , (unsigned int)x , etc const Token *prev = tok->previous();