From f36ef2d26de526d946cd6af58e19c5a17cc51661 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 6 Jun 2009 13:39:36 +0000 Subject: [PATCH] 2009-06-06 Tatsuhiro Tsujikawa Use htmlEscape instead of xmlEscape. Removed static function xmlEscape. * src/XmlRpcResponse.cc --- ChangeLog | 5 +++++ src/XmlRpcResponse.cc | 23 ++++------------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b2a9d9c..06ad93de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-06 Tatsuhiro Tsujikawa + + Use htmlEscape instead of xmlEscape. Removed static function xmlEscape. + * src/XmlRpcResponse.cc + 2009-06-06 Tatsuhiro Tsujikawa Avoid intermediate object during string concatenation. diff --git a/src/XmlRpcResponse.cc b/src/XmlRpcResponse.cc index 98beb766..1e194d23 100644 --- a/src/XmlRpcResponse.cc +++ b/src/XmlRpcResponse.cc @@ -37,27 +37,12 @@ #include #include +#include "Util.h" + namespace aria2 { namespace xmlrpc { -static std::string xmlEscape(const std::string& s) -{ - std::string d; - for(std::string::const_iterator i = s.begin(); i != s.end(); ++i) { - if(*i == '<') { - d += "<"; - } else if(*i == '>') { - d += ">"; - } else if(*i == '&') { - d += "&"; - } else { - d += *i; - } - } - return d; -} - static void encodeValue(const BDE& value, std::ostream& o); template @@ -78,7 +63,7 @@ static void encodeStruct o << ""; for(; first != last; ++first) { o << "" - << "" << xmlEscape((*first).first) << ""; + << "" << Util::htmlEscape((*first).first) << ""; encodeValue((*first).second, o); o << ""; } @@ -89,7 +74,7 @@ static void encodeValue(const BDE& value, std::ostream& o) { o << ""; if(value.isString()) { - o << "" << xmlEscape(value.s()) << ""; + o << "" << Util::htmlEscape(value.s()) << ""; } else if(value.isInteger()) { o << "" << value.i() << ""; } else if(value.isList()) {