summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-05 20:14:31 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-05 20:14:31 (GMT)
commit01e8f4792591f744893ab7ff799200efc8ad299a (patch)
tree9b5001b242ec114f72bfaef3757eebe7d7ebc2cd /SwifTools
parent772b2ec0243d7b55d91e4027d828881d18093ed0 (diff)
downloadswift-contrib-01e8f4792591f744893ab7ff799200efc8ad299a.zip
swift-contrib-01e8f4792591f744893ab7ff799200efc8ad299a.tar.bz2
Use naive XMPPURI transformation to work around a bug in GCC4.5+boost1.42.
Diffstat (limited to 'SwifTools')
-rw-r--r--SwifTools/URIHandler/XMPPURI.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/SwifTools/URIHandler/XMPPURI.cpp b/SwifTools/URIHandler/XMPPURI.cpp
index de83ac2..cb81391 100644
--- a/SwifTools/URIHandler/XMPPURI.cpp
+++ b/SwifTools/URIHandler/XMPPURI.cpp
@@ -18,6 +18,9 @@
using namespace Swift;
+// Disabling this code for now, since GCC4.5+boost1.42 (on ubuntu) seems to
+// result in a bug. Replacing it with naive code.
+#if 0
// Should be in anonymous namespace, but older GCCs complain if we do that
struct PercentEncodedCharacterFinder {
template<typename Iterator>
@@ -63,6 +66,35 @@ namespace {
}
}
}
+#endif
+namespace {
+ std::string unescape(const std::string& str) {
+ std::string result;
+ for (size_t i = 0; i < str.size(); ++i) {
+ if (str[i] == '%') {
+ if (i + 3 < str.size()) {
+ std::stringstream s;
+ s << std::hex << str.substr(i+1, 2);
+ unsigned int value;
+ s >> value;
+ if (s.fail() || s.bad()) {
+ return "";
+ }
+ unsigned char charValue = static_cast<unsigned char>(value);
+ result += std::string(reinterpret_cast<const char*>(&charValue), 1);
+ i += 2;
+ }
+ else {
+ return "";
+ }
+ }
+ else {
+ result += str[i];
+ }
+ }
+ return result;
+ }
+}
XMPPURI::XMPPURI() {
}