From 745fa9e985d0de8c74a96b79f77ff3c9d11d1faa Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 13 Jun 2015 15:05:07 +0200 Subject: [PATCH] fixed bug in parsing printf text tokens --- HISTORY | 1 + libtemplate/templatefunction.c | 20 ++++++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/HISTORY b/HISTORY index 7f3d348..1dce80f 100644 --- a/HISTORY +++ b/HISTORY @@ -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 diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index b2bad34..6c6ae5c 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -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::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::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()); } } }