the offset is used to ignore the first characters in the unreserved_chars table.
| 139 | |
| 140 | // the offset is used to ignore the first characters in the unreserved_chars table. |
| 141 | std::string escape_string_impl(const char* str, int const len, int const offset) |
| 142 | { |
| 143 | TORRENT_ASSERT(str != nullptr); |
| 144 | TORRENT_ASSERT(len >= 0); |
| 145 | TORRENT_ASSERT(offset >= 0); |
| 146 | TORRENT_ASSERT(offset < int(sizeof(unreserved_chars)) - 1); |
| 147 | |
| 148 | std::string ret; |
| 149 | for (int i = 0; i < len; ++i) |
| 150 | { |
| 151 | if (std::strchr(unreserved_chars + offset, *str) && *str != 0) |
| 152 | { |
| 153 | ret += *str; |
| 154 | } |
| 155 | else |
| 156 | { |
| 157 | ret += '%'; |
| 158 | ret += aux::hex_chars[std::uint8_t(*str) >> 4]; |
| 159 | ret += aux::hex_chars[std::uint8_t(*str) & 15]; |
| 160 | } |
| 161 | ++str; |
| 162 | } |
| 163 | return ret; |
| 164 | } |
| 165 | |
| 166 | } // anonymous namespace |
| 167 |
no outgoing calls
no test coverage detected