fixed bug in parsing printf text tokens

This commit is contained in:
louis 2015-06-13 15:05:07 +02:00
parent ffca82a883
commit 745fa9e985
2 changed files with 9 additions and 12 deletions

View File

@ -367,3 +367,4 @@ Version 0.5.2
to displaymenurecordings listelement
- allow currentelements to use conditions
- fixed bug searching channel logos with channelid
- fixed bug in parsing printf text tokens

View File

@ -991,14 +991,13 @@ void cTemplateFunction::ParseTextToken(string &value, size_t start, size_t end)
value = value.replace(0, start, "");
token.type = ttConstString;
token.value = constString;
textTokens.push_back(token);
} else {
string tokenName = value.substr(1, end - start - 1);
value = value.replace(0, end - start + 1, "");
token.type = ttToken;
token.value = tokenName;
textTokens.push_back(token);
}
textTokens.push_back(token);
}
void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, size_t end) {
@ -1008,7 +1007,6 @@ void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, s
value = value.replace(0, start, "");
token.type = ttConstString;
token.value = constString;
textTokens.push_back(token);
} else {
string condToken = value.substr(start + 1, end - start - 1);
value = value.replace(0, end - start + 1, "");
@ -1041,9 +1039,8 @@ void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, s
token.type = ttConditionalToken;
token.value = tokenName;
token.subTokens = subTokens;
textTokens.push_back(token);
}
textTokens.push_back(token);
}
void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t end) {
@ -1053,7 +1050,6 @@ void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t
value = value.replace(0, start, "");
token.type = ttConstString;
token.value = constString;
textTokens.push_back(token);
} else {
token.type = ttPrintfToken;
//fetch parameter list from printf
@ -1814,14 +1810,14 @@ void cTemplateFunction::Debug(void) {
eTextTokenType tokenType = (*it).type;
string tokType = "";
if (tokenType == ttConstString)
tokType = "Const: ";
tokType = "Const";
else if (tokenType == ttToken)
tokType = "Token: ";
tokType = "Token";
else if (tokenType == ttConditionalToken)
tokType = "Conditional Token: ";
tokType = "Conditional Token";
else if (tokenType == ttPrintfToken)
tokType = "PrintF Token: ";
esyslog("skindesigner: %s %d = \"%s\"", tokType.c_str(), i++, (*it).value.c_str());
tokType = "PrintF Token";
esyslog("skindesigner: Token %d Type %s : \"%s\"", i++, tokType.c_str(), (*it).value.c_str());
if (tokenType == ttConditionalToken) {
for (vector<cTextToken>::iterator it2 = (*it).subTokens.begin(); it2 != (*it).subTokens.end(); it2++) {
eTextTokenType tokenTypeCond = (*it2).type;
@ -1835,7 +1831,7 @@ void cTemplateFunction::Debug(void) {
}
if (tokenType == ttPrintfToken) {
for (vector<string>::iterator it2 = (*it).parameters.begin(); it2 != (*it).parameters.end(); it2++) {
esyslog("skindesigner: Printf parameter: %s", (*it2).c_str());
esyslog("skindesigner: PrintF parameter: %s", (*it2).c_str());
}
}
}