Fix for bug 88623 (Cleanup Transformiix code). Removing some warnings, fixing txResultStringComparator::compareValues, adding isEmpty to our string class. r=sicking, r=Pike, sr=jst.

git-svn-id: svn://10.0.0.236/trunk@105492 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%netscape.com
2001-10-16 09:26:59 +00:00
parent 36ec5b1b6c
commit ebdf68cab6
26 changed files with 167 additions and 154 deletions

View File

@@ -234,8 +234,15 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) {
break;
case TRANSLATE:
if ( requireParams(3, 3, cs) ) {
String src, oldChars, newChars;
String src;
evaluateToString((Expr*)iter->next(),context, cs, src);
if (src.isEmpty()) {
result = new StringResult("");
break;
}
String oldChars, newChars;
evaluateToString((Expr*)iter->next(),context, cs, oldChars);
evaluateToString((Expr*)iter->next(),context, cs, newChars);
PRInt32 size = src.length();
@@ -245,10 +252,12 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) {
for (i = 0; i < size; i++) {
PRInt32 idx = oldChars.indexOf(chars[i]);
if (idx >= 0) {
if (idx<newChars.length())
if (idx < newChars.length())
src.append(newChars.charAt(idx));
}
else src.append(chars[i]);
else {
src.append(chars[i]);
}
}
delete chars;
result = new StringResult(src);