MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3 / encode

Function encode

openvpn/http/urlencode.hpp:39–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 OPENVPN_EXCEPTION(url_error);
38
39 inline std::string encode(const std::string& str)
40 {
41 std::string ret;
42 ret.reserve(str.length() * 2); // just a guess
43 for (auto &c : str)
44 {
45 if (HTTP::Util::is_escaped(c))
46 {
47 ret += '%';
48 ret += render_hex_number((unsigned char)c, true);
49 }
50 else
51 ret += c;
52 }
53 return ret;
54 }
55
56 inline std::string decode(const std::string& encoded)
57 {

Callers 1

encodeMethod · 0.85

Calls 4

is_escapedFunction · 0.85
render_hex_numberFunction · 0.85
reserveMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected