diff options
author | Roland Reichwein <mail@reichwein.it> | 2023-01-03 09:31:51 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2023-01-03 09:31:51 +0100 |
commit | 2b6f8123e925e3be8ce7c04eccdd49fc728314a5 (patch) | |
tree | 78e86bb428b3bc821ae84d0f6abe86136356bd1a /libcommon/url.cpp | |
parent | 5581340f23b31114d33736c630de849898668f38 (diff) |
Separated out libcommon as libreichwein
Diffstat (limited to 'libcommon/url.cpp')
-rw-r--r-- | libcommon/url.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/libcommon/url.cpp b/libcommon/url.cpp deleted file mode 100644 index 5baf603..0000000 --- a/libcommon/url.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "url.h" - -std::string urlDecode(std::string s) -{ - std::string result; - - size_t pos = 0; - while (pos < s.size()) { - char c {s[pos]}; - if (c == '+') { - result += ' '; - } else if (c == '%' && pos + 2 < s.size()) { - try { - int i = stoi(s.substr(pos + 1, 2), 0, 16); - if (i < 0 || i > 255) - return result; - - result += static_cast<char>(i); - } catch (...) { - return result; - } - - pos += 2; - } else { - result += c; - } - pos++; - } - - return result; -} - |