mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Fixed a memory leak when using the Translate function,
also made change to use the String::toUnicode method instead of String::toCharArray
This commit is contained in:
parent
9492c6f504
commit
303bee7d02
@ -21,14 +21,14 @@
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: StringFunctionCall.cpp,v 1.2 1999/11/15 07:13:13 nisheeth%netscape.com Exp $
|
||||
* $Id: StringFunctionCall.cpp,v 1.3 2000/03/31 07:10:12 kvisco%ziplink.net Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* StringFunctionCall
|
||||
* A representation of the XPath String funtions
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.2 $ $Date: 1999/11/15 07:13:13 $
|
||||
* @version $Revision: 1.3 $ $Date: 2000/03/31 07:10:12 $
|
||||
**/
|
||||
|
||||
#include "FunctionLib.h"
|
||||
@ -200,8 +200,7 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) {
|
||||
evaluateToString((Expr*)iter->next(),context, cs, oldChars);
|
||||
evaluateToString((Expr*)iter->next(),context, cs, newChars);
|
||||
Int32 size = src.length();
|
||||
char* chars = new char[size+1];
|
||||
src.toChar(chars);
|
||||
UNICODE_CHAR* chars = src.toUnicode(new UNICODE_CHAR[size]);
|
||||
src.clear();
|
||||
Int32 newIdx = 0;
|
||||
Int32 i;
|
||||
@ -213,6 +212,7 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) {
|
||||
}
|
||||
else src.append(chars[i]);
|
||||
}
|
||||
delete chars;
|
||||
return new StringResult(src);
|
||||
}
|
||||
result = new StringResult("");
|
||||
|
Loading…
Reference in New Issue
Block a user