Commit af554889 authored by louiz’'s avatar louiz’

Cosmetic

parent ccebe901
......@@ -5,20 +5,32 @@
std::string xml_escape(const std::string& data)
{
std::string res;
buffer.reserve(data.size());
for(size_t pos = 0; pos != data.size(); ++pos)
res.reserve(data.size());
for (size_t pos = 0; pos != data.size(); ++pos)
{
switch(data[pos])
{
case '&': buffer += "&"; break;
case '\"': buffer += """; break;
case '\'': buffer += "'"; break;
case '<': buffer += "&lt;"; break;
case '>': buffer += "&gt;"; break;
default: buffer += data[pos]; break;
case '&':
res += "&amp;";
break;
case '<':
res += "&lt;";
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