From 01e8f4792591f744893ab7ff799200efc8ad299a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Thu, 5 May 2011 22:14:31 +0200 Subject: Use naive XMPPURI transformation to work around a bug in GCC4.5+boost1.42. 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 @@ -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(value); + result += std::string(reinterpret_cast(&charValue), 1); + i += 2; + } + else { + return ""; + } + } + else { + result += str[i]; + } + } + return result; + } +} XMPPURI::XMPPURI() { } -- cgit v0.10.2-6-g49f6