summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-11-09 06:29:15 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-11-09 06:29:15 +0100
commitaf5548897a8395a868f3ff2d716391a0c5ec92fe (patch)
tree7ab36f5f2abf2df57c7e8cfe868af941d0399eb8 /src/xmpp
parentccebe901d7d76dfddc082d994efa54ef2aefee57 (diff)
downloadbiboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.tar.gz
biboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.tar.bz2
biboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.tar.xz
biboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.zip
Cosmetic
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/xmpp_stanza.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/xmpp/xmpp_stanza.cpp b/src/xmpp/xmpp_stanza.cpp
index 4c0088e..d856836 100644
--- a/src/xmpp/xmpp_stanza.cpp
+++ b/src/xmpp/xmpp_stanza.cpp
@@ -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 += "&amp;"; break;
- case '\"': buffer += "&quot;"; break;
- case '\'': buffer += "&apos;"; 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;
}