MCPcopy Create free account
hub / github.com/audacity/audacity / UrlDecode

Function UrlDecode

libraries/lib-string-utils/UrlDecode.cpp:18–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{
17
18std::string UrlDecode (const std::string& url)
19{
20 std::string result;
21
22 const size_t length = url.length ();
23
24 for (auto it = url.begin (), end = url.end (); it != end; ++it)
25 {
26 const char c = *it;
27
28 if (c != '%')
29 {
30 result.push_back (c);
31 }
32 else
33 {
34 if (++it == url.end ())
35 break; // Malformed input string
36
37 const char c1 = *it;
38
39 if (++it == url.end ())
40 break; // Malformed input string
41
42 const char c2 = *it;
43
44 result.push_back (HexCharToNum (c1) << 4 | HexCharToNum (c2));
45 }
46 }
47
48 return result;
49}
50
51}

Callers 1

HandleLinkURIMethod · 0.85

Calls 5

HexCharToNumFunction · 0.85
lengthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected