2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Use htmlEscape instead of xmlEscape. Removed static function xmlEscape.
	* src/XmlRpcResponse.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-06-06 13:39:36 +00:00
parent c7275bd978
commit f36ef2d26d
2 changed files with 9 additions and 19 deletions

View File

@ -1,3 +1,8 @@
2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use htmlEscape instead of xmlEscape. Removed static function xmlEscape.
* src/XmlRpcResponse.cc
2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Avoid intermediate object during string concatenation.

View File

@ -37,27 +37,12 @@
#include <cassert>
#include <sstream>
#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 += "&lt;";
} else if(*i == '>') {
d += "&gt;";
} else if(*i == '&') {
d += "&amp;";
} else {
d += *i;
}
}
return d;
}
static void encodeValue(const BDE& value, std::ostream& o);
template<typename InputIterator>
@ -78,7 +63,7 @@ static void encodeStruct
o << "<struct>";
for(; first != last; ++first) {
o << "<member>"
<< "<name>" << xmlEscape((*first).first) << "</name>";
<< "<name>" << Util::htmlEscape((*first).first) << "</name>";
encodeValue((*first).second, o);
o << "</member>";
}
@ -89,7 +74,7 @@ static void encodeValue(const BDE& value, std::ostream& o)
{
o << "<value>";
if(value.isString()) {
o << "<string>" << xmlEscape(value.s()) << "</string>";
o << "<string>" << Util::htmlEscape(value.s()) << "</string>";
} else if(value.isInteger()) {
o << "<int>" << value.i() << "</int>";
} else if(value.isList()) {