From 5645269bbf1436f55f7bf9467a3df29156a1e77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 13 Jul 2012 11:36:02 +0200 Subject: [PATCH] Preprocessor: Made proper fix for #3690 --- lib/preprocessor.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 1c45b6eb3..239077345 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -2560,7 +2560,7 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg) { // fill up "macros" with empty configuration macros std::set macros; - for (std::string::size_type pos = 0; pos < cfg.size(); ++pos) { + for (std::string::size_type pos = 0; pos < cfg.size();) { const std::string::size_type pos2 = cfg.find_first_of(";=", pos); if (pos2 == std::string::npos) { macros.insert(cfg.substr(pos)); @@ -2569,9 +2569,8 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg) if (cfg[pos2] == ';') macros.insert(cfg.substr(pos, pos2-pos)); pos = cfg.find(";", pos2); - if (pos == std::string::npos) - break; - ++pos; + if (pos != std::string::npos) + ++pos; } // check if any empty macros are used in code