summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glcdskin/function.c12
-rw-r--r--glcdskin/string.c36
2 files changed, 28 insertions, 20 deletions
diff --git a/glcdskin/function.c b/glcdskin/function.c
index fce45b6..a2d58ca 100644
--- a/glcdskin/function.c
+++ b/glcdskin/function.c
@@ -406,22 +406,22 @@ cType cSkinFunction::Evaluate(void) const
case fun_equal:
case fun_eq:
- return mParams[0]->Evaluate() == mParams[1]->Evaluate();
+ return (std::string) mParams[0]->Evaluate() == (std::string) mParams[1]->Evaluate();
case fun_ne:
- return mParams[0]->Evaluate() != mParams[1]->Evaluate();
+ return (std::string) mParams[0]->Evaluate() != (std::string) mParams[1]->Evaluate();
case fun_gt:
- return mParams[0]->Evaluate() > mParams[1]->Evaluate();
+ return (int) mParams[0]->Evaluate() > (int) mParams[1]->Evaluate();
case fun_lt:
- return mParams[0]->Evaluate() < mParams[1]->Evaluate();
+ return (int) mParams[0]->Evaluate() < (int) mParams[1]->Evaluate();
case fun_ge:
- return mParams[0]->Evaluate() >= mParams[1]->Evaluate();
+ return (int) mParams[0]->Evaluate() >= (int) mParams[1]->Evaluate();
case fun_le:
- return mParams[0]->Evaluate() <= mParams[1]->Evaluate();
+ return (int) mParams[0]->Evaluate() <= (int) mParams[1]->Evaluate();
case fun_file:
return FunFile(mParams[0]->Evaluate());
diff --git a/glcdskin/string.c b/glcdskin/string.c
index 9744315..4e96a29 100644
--- a/glcdskin/string.c
+++ b/glcdskin/string.c
@@ -263,23 +263,31 @@ cType cSkinString::Evaluate(void) const
while ( (idxstart=result_raw.find("#", idxstart)) != std::string::npos ) {
result_trans.append(result_raw.substr(pos, idxstart-pos));
idxend = result_raw.find("#", idxstart+1);
- cSkinVariable * variable = mSkin->GetVariable(result_raw.substr(idxstart+1, idxend-idxstart-1));
- if (variable) {
- std::string val = (std::string) variable->Value();
-
- // if value of variable contains token definions: reparse value
- if (val.find("{") != std::string::npos) {
- cSkinString *result = new cSkinString(Object(), false);
- if (result->Parse(val)) {
- val = (std::string) result->Evaluate();
+ if (idxend != std::string::npos) {
+ cSkinVariable * variable = mSkin->GetVariable(result_raw.substr(idxstart+1, idxend-idxstart-1));
+ if (variable) {
+ std::string val = (std::string) variable->Value();
+
+ // if value of variable contains token definions: reparse value
+ if (val.find("{") != std::string::npos) {
+ cSkinString *result = new cSkinString(Object(), false);
+ if (result->Parse(val)) {
+ val = (std::string) result->Evaluate();
+ }
+ delete result;
}
- delete result;
+ result_trans.append (val);
+ // syslog(LOG_ERR, "string variable %s", trans.c_str());
+ } else {
+ result_trans.append (result_raw.substr(idxstart, idxend-idxstart)); // no variable found: print as raw text
}
- result_trans.append (val);
- // syslog(LOG_ERR, "string variable %s", trans.c_str());
+ idxstart = idxend+1;
+ pos = idxstart;
+ } else {
+ result_trans.append ("#"); // no closing '#' -> print # as raw text
+ idxstart ++;
+ pos = idxstart;
}
- idxstart = idxend+1;
- pos = idxstart;
}
result_trans.append(result_raw.substr(pos));