Use size_t type. Improved formatting.

This commit is contained in:
JonathanSteininger 2025-05-16 14:02:31 +12:00
parent 0de9282964
commit 884462a5a4

View file

@ -701,7 +701,7 @@ CParseResult CConfig::parseLine(std::string line, bool dynamic) {
// Right now only expression parsing has escapeable chars
const char ESCAPE_CHAR = '\\';
const std::array<char, 2> ESCAPE_SET{'{', '}'};
for (long i = 0; i < (long)RHS.length() - (long)1; i++) {
for (size_t i = 0; RHS.length() != 0 && i < RHS.length() - 1; i++) {
if (RHS.at(i) != ESCAPE_CHAR)
continue;
//if escaping an escape, remove and skip the next char
@ -710,11 +710,11 @@ CParseResult CConfig::parseLine(std::string line, bool dynamic) {
continue;
}
//checks if any of the chars were escapable.
for (unsigned int j = 0; j < ESCAPE_SET.size(); j++) {
if (RHS.at(i + 1) == ESCAPE_SET[j]) {
RHS.erase(i--, 1);
break;
}
for (size_t j = 0; j < ESCAPE_SET.size(); j++) {
if (RHS.at(i + 1) != ESCAPE_SET[j])
continue;
RHS.erase(i--, 1);
break;
}
}