------------------------------------------------------------ revno: 3279 committer: poy <p...@123gen.com> branch nick: trunk timestamp: Sun 2013-04-28 22:52:23 +0200 message: avoid stringstream modified: dcpp/ChatMessage.cpp dcpp/Util.cpp
-- lp:dcplusplus https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk Your team Dcplusplus-team is subscribed to branch lp:dcplusplus. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/ChatMessage.cpp' --- dcpp/ChatMessage.cpp 2013-01-29 18:08:36 +0000 +++ dcpp/ChatMessage.cpp 2013-04-28 20:52:23 +0000 @@ -47,12 +47,11 @@ string tmp; string xmlTmp; - auto addSpan = [&xmlTmp](char* id, const string& content, const string& style) -> string { - std::stringstream stream; - stream << "<span id=\"" << id << "\""; - if(!style.empty()) { stream << " style=\"" << SimpleXML::escape(style, xmlTmp, true) << "\""; } - stream << ">" << SimpleXML::escape(content, xmlTmp, false) << "</span>"; - return stream.str(); + auto addSpan = [&xmlTmp](string id, const string& content, const string& style) -> string { + string ret = "<span id=\"" + move(id) + "\""; + if(!style.empty()) { ret += " style=\"" + SimpleXML::escape(style, xmlTmp, true) + "\""; } + ret += ">" + SimpleXML::escape(content, xmlTmp, false) + "</span>"; + return ret; }; htmlMessage += "<span id=\"message\" style=\"white-space: pre-wrap;\">"; === modified file 'dcpp/Util.cpp' --- dcpp/Util.cpp 2013-01-18 21:28:38 +0000 +++ dcpp/Util.cpp 2013-04-28 20:52:23 +0000 @@ -814,10 +814,15 @@ StringTokenizer<string> st(font, ','); auto& l = st.getTokens(); if(l.size() >= 4) { - std::stringstream stream; - stream << (Util::toInt(l[3]) ? "italic" : "normal") << " " << l[2] << " " << - abs(Util::toFloat(l[1])) << "px '" << l[0] << "'"; - return stream.str(); + string ret = Util::toInt(l[3]) ? "italic" : "normal"; + ret += ' '; + ret += l[2]; + ret += ' '; + ret += Util::toString(abs(Util::toFloat(l[1]))); + ret += "px '"; + ret += l[0]; + ret += "'"; + return ret; } return string(); #else
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp