mirror of https://github.com/aria2/aria2
2009-06-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use htmlEscape instead of xmlEscape. Removed static function xmlEscape. * src/XmlRpcResponse.ccpull/1/head
parent
c7275bd978
commit
f36ef2d26d
|
@ -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.
|
||||
|
|
|
@ -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 += "<";
|
||||
} else if(*i == '>') {
|
||||
d += ">";
|
||||
} else if(*i == '&') {
|
||||
d += "&";
|
||||
} 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()) {
|
||||
|
|
Loading…
Reference in New Issue