diff options
author | Florent Le Coz <louiz@louiz.org> | 2013-11-09 06:29:15 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2013-11-09 06:29:15 +0100 |
commit | af5548897a8395a868f3ff2d716391a0c5ec92fe (patch) | |
tree | 7ab36f5f2abf2df57c7e8cfe868af941d0399eb8 | |
parent | ccebe901d7d76dfddc082d994efa54ef2aefee57 (diff) | |
download | biboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.tar.gz biboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.tar.bz2 biboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.tar.xz biboumi-af5548897a8395a868f3ff2d716391a0c5ec92fe.zip |
Cosmetic
-rw-r--r-- | src/xmpp/xmpp_stanza.cpp | 30 |
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 += "&"; break; - case '\"': buffer += """; break; - case '\'': buffer += "'"; break; - case '<': buffer += "<"; break; - case '>': buffer += ">"; break; - default: buffer += data[pos]; break; + case '&': + res += "&"; + break; + case '<': + res += "<"; + break; + case '>': + res += ">"; + break; + case '\"': + res += """; + break; + case '\'': + res += "'"; + break; + default: + res += data[pos]; + break; } } - return buffer; + return res; } |