diff --git a/src/ui/util/conf/ruletextparser.cpp b/src/ui/util/conf/ruletextparser.cpp index 446f6b7d..758c35d8 100644 --- a/src/ui/util/conf/ruletextparser.cpp +++ b/src/ui/util/conf/ruletextparser.cpp @@ -94,7 +94,7 @@ void RuleTextParser::setError(ErrorCode errorCode, const QString &errorMessage) bool RuleTextParser::parseLines() { - const int nodeIndex = beginList(FORT_RULE_FILTER_TYPE_LIST_OR); + const int filterIndex = beginList(FORT_RULE_FILTER_TYPE_LIST_OR); for (;;) { if (!parseLineComments()) @@ -104,7 +104,7 @@ bool RuleTextParser::parseLines() break; } - endList(nodeIndex); + endList(filterIndex); return !hasError(); } @@ -124,7 +124,7 @@ bool RuleTextParser::parseLineComments() bool RuleTextParser::parseLine() { - const int nodeIndex = beginList(FORT_RULE_FILTER_TYPE_LIST_AND); + const int filterIndex = beginList(FORT_RULE_FILTER_TYPE_LIST_AND); RuleCharTypes expectedSeparator = CharNone; @@ -153,7 +153,7 @@ bool RuleTextParser::parseLine() expectedSeparator = CharColon | CharNewLine; } - endList(nodeIndex); + endList(filterIndex); return !hasError(); } @@ -423,18 +423,18 @@ int RuleTextParser::beginList(qint8 listType) return nodeIndex; } -void RuleTextParser::endList(int nodeIndex) +void RuleTextParser::endList(int filterIndex) { - const int currentIndex = m_ruleFilters.size(); + const int currentIndex = m_ruleFilters.size() - 1; - if (currentIndex == nodeIndex + 1) { + if (currentIndex == filterIndex) { m_ruleFilters.removeLast(); // Empty list return; } - RuleFilter &ruleFilter = m_ruleFilters[nodeIndex]; + RuleFilter &ruleFilter = m_ruleFilters[filterIndex]; - ruleFilter.listCount = currentIndex - nodeIndex; + ruleFilter.filterListCount = currentIndex - filterIndex; } bool RuleTextParser::skipComments(RuleCharTypes expectedCharTypes) diff --git a/src/ui/util/conf/ruletextparser.h b/src/ui/util/conf/ruletextparser.h index b3249af6..c4fa3ba4 100644 --- a/src/ui/util/conf/ruletextparser.h +++ b/src/ui/util/conf/ruletextparser.h @@ -49,7 +49,7 @@ struct RuleFilter qint8 type = 0; - quint16 listCount = 0; + quint16 filterListCount = 0; StringViewList values; }; @@ -117,7 +117,7 @@ private: void addFilter(); int beginList(qint8 listType); - void endList(int nodeIndex); + void endList(int filterIndex); void resetParsedCharTypes() { m_parsedCharTypes = CharNone; } bool hasParsedCharTypes(RuleCharTypes v) { return v == 0 || (m_parsedCharTypes & v) != 0; } @@ -130,7 +130,7 @@ private: bool isEmpty() const { return m_p >= m_end; } - RuleFilter &listNode(int listIndex) { return m_ruleFilters[listIndex]; } + RuleFilter &listNode(int filterIndex) { return m_ruleFilters[filterIndex]; } bool skipComments(RuleCharTypes expectedCharTypes);