static void url_decode(TCHAR* str) { TCHAR* s = str, *d = str; while(*s) { if (*s == '%') { int digit1 = SingleHexToDecimal(s[1]); if (digit1 != -1) { int digit2 = SingleHexToDecimal(s[2]); if (digit2 != -1) { s += 3; *d++ = (TCHAR)((digit1 << 4) | digit2); continue; } } } *d++ = *s++; } *d = 0; }
template <class chartype> void UrlDecode(chartype* str) { chartype* s = str, *d = str; while(*s) { if (*s == '%') { int digit1 = SingleHexToDecimal(s[1]); if (digit1 != -1) { int digit2 = SingleHexToDecimal(s[2]); if (digit2 != -1) { s += 3; *d++ = (char)((digit1 << 4) | digit2); continue; } } } *d++ = *s++; } *d = 0; }
static void PQDecode(char* str) { char* s = str, *d = str; while(*s) { switch (*s) { case '=': { int digit1 = SingleHexToDecimal(s[1]); if (digit1 != -1) { int digit2 = SingleHexToDecimal(s[2]); if (digit2 != -1) { s += 3; *d++ = (char)((digit1 << 4) | digit2); } } break; } case '_': *d++ = ' '; ++s; break; default: *d++ = *s++; break; } } *d = 0; }