Commit af554889 authored by louiz’'s avatar louiz’

Cosmetic

parent ccebe901
...@@ -5,20 +5,32 @@ ...@@ -5,20 +5,32 @@
std::string xml_escape(const std::string& data) std::string xml_escape(const std::string& data)
{ {
std::string res; std::string res;
buffer.reserve(data.size()); res.reserve(data.size());
for(size_t pos = 0; pos != data.size(); ++pos) for (size_t pos = 0; pos != data.size(); ++pos)
{ {
switch(data[pos]) switch(data[pos])
{ {
case '&': buffer += "&"; break; case '&':
case '\"': buffer += """; break; res += "&";
case '\'': buffer += "'"; break; break;
case '<': buffer += "&lt;"; break; case '<':
case '>': buffer += "&gt;"; break; res += "&lt;";
default: buffer += data[pos]; break; break;
case '>':
res += "&gt;";
break;
case '\"':
res += "&quot;";
break;
case '\'':
res += "&apos;";
break;
default:
res += data[pos];
break;
} }
} }
return buffer; return res;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment