| 122 | |
| 123 | template <class It1, class It2, class It3, class FromHex> |
| 124 | static inline It1 Unescape(It1 to, It2 from, It3 end, FromHex fromHex) { |
| 125 | (void)fromHex; |
| 126 | |
| 127 | while (from != end) { |
| 128 | switch (*from) { |
| 129 | case '%': |
| 130 | ++from; |
| 131 | *to++ = fromHex.x2c(from); |
| 132 | break; |
| 133 | case '+': |
| 134 | *to++ = ' '; |
| 135 | ++from; |
| 136 | break; |
| 137 | default: |
| 138 | *to++ = *from++; |
| 139 | } |
| 140 | } |
| 141 | *to = 0; |
| 142 | return to; |
| 143 | } |
| 144 | |
| 145 | // CGIEscape returns pointer to the end of the result string |
| 146 | // so as it could be possible to populate single long buffer |