diff options
author | louis <louis.braun@gmx.de> | 2014-11-02 11:19:05 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2014-11-02 11:19:05 +0100 |
commit | 80ac2607514422cfd77efb3429e0f70fc8713c39 (patch) | |
tree | fafa3e4c78511f95d4b9f6dc83aabd967c60cebe /libtemplate/templatefunction.c | |
parent | e258e9d9a6e221bfc5782dca176316a64d33c6cb (diff) | |
download | vdr-plugin-skindesigner-80ac2607514422cfd77efb3429e0f70fc8713c39.tar.gz vdr-plugin-skindesigner-80ac2607514422cfd77efb3429e0f70fc8713c39.tar.bz2 |
fixed bug in printf function
Diffstat (limited to 'libtemplate/templatefunction.c')
-rw-r--r-- | libtemplate/templatefunction.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 699e872..2a6e5a3 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -981,20 +981,28 @@ void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, s void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t end) {
cTextToken token;
- token.type = ttPrintfToken;
- //fetch parameter list from printf
- string printfParams = value.substr(start + 8, end - start - 9);
- value = value.replace(0, end - start + 1, "");
- splitstring s(printfParams.c_str());
- vector<string> flds = s.split(',', 1);
-
- int numParams = flds.size();
- if (numParams < 1)
- return;
- string formatString = trim(flds[0]);
- token.value = formatString.substr(1, formatString.size() - 2);
- for (int i=1; i < numParams; i++) {
- token.parameters.push_back(trim(flds[i]));
+ if (start > 0) {
+ string constString = value.substr(0, start);
+ value = value.replace(0, start, "");
+ token.type = ttConstString;
+ token.value = constString;
+ textTokens.push_back(token);
+ } else {
+ token.type = ttPrintfToken;
+ //fetch parameter list from printf
+ string printfParams = value.substr(start + 8, end - start - 9);
+ value = value.replace(0, end - start + 1, "");
+ splitstring s(printfParams.c_str());
+ vector<string> flds = s.split(',', 1);
+
+ int numParams = flds.size();
+ if (numParams < 1)
+ return;
+ string formatString = trim(flds[0]);
+ token.value = formatString.substr(1, formatString.size() - 2);
+ for (int i=1; i < numParams; i++) {
+ token.parameters.push_back(trim(flds[i]));
+ }
}
textTokens.push_back(token);
}
@@ -1588,6 +1596,8 @@ void cTemplateFunction::Debug(void) { tokType = "Token: ";
else if (tokenType == ttConditionalToken)
tokType = "Conditional Token: ";
+ else if (tokenType == ttPrintfToken)
+ tokType = "PrintF Token: ";
esyslog("skindesigner: %s %d = \"%s\"", tokType.c_str(), i++, (*it).value.c_str());
if (tokenType == ttConditionalToken) {
for (vector<cTextToken>::iterator it2 = (*it).subTokens.begin(); it2 != (*it).subTokens.end(); it2++) {
@@ -1600,6 +1610,11 @@ void cTemplateFunction::Debug(void) { esyslog("skindesigner: %s \"%s\"", tokTypeCond.c_str(), (*it2).value.c_str());
}
}
+ if (tokenType == ttPrintfToken) {
+ for (vector<string>::iterator it2 = (*it).parameters.begin(); it2 != (*it).parameters.end(); it2++) {
+ esyslog("skindesigner: Printf parameter: %s", (*it2).c_str());
+ }
+ }
}
}
if (fontName.size() > 0) {
|