Preprocessor: Made proper fix for #3690

This commit is contained in:
Daniel Marjamäki 2012-07-13 11:36:02 +02:00
parent e4ad193b40
commit 5645269bbf
1 changed files with 3 additions and 4 deletions

View File

@ -2560,7 +2560,7 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg)
{ {
// fill up "macros" with empty configuration macros // fill up "macros" with empty configuration macros
std::set<std::string> macros; std::set<std::string> 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); const std::string::size_type pos2 = cfg.find_first_of(";=", pos);
if (pos2 == std::string::npos) { if (pos2 == std::string::npos) {
macros.insert(cfg.substr(pos)); macros.insert(cfg.substr(pos));
@ -2569,9 +2569,8 @@ bool Preprocessor::validateCfg(const std::string &code, const std::string &cfg)
if (cfg[pos2] == ';') if (cfg[pos2] == ';')
macros.insert(cfg.substr(pos, pos2-pos)); macros.insert(cfg.substr(pos, pos2-pos));
pos = cfg.find(";", pos2); pos = cfg.find(";", pos2);
if (pos == std::string::npos) if (pos != std::string::npos)
break; ++pos;
++pos;
} }
// check if any empty macros are used in code // check if any empty macros are used in code