diff options
Diffstat (limited to 'lib/tar/urldecode.c')
-rw-r--r-- | lib/tar/urldecode.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/tar/urldecode.c b/lib/tar/urldecode.c deleted file mode 100644 index 6fac4d3..0000000 --- a/lib/tar/urldecode.c +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * urldecode.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" - -#include "internal.h" - -static int xdigit(int x) -{ - if (isupper(x)) - return x - 'A' + 0x0A; - if (islower(x)) - return x - 'a' + 0x0A; - return x - '0'; -} - -void urldecode(char *str) -{ - unsigned char *out = (unsigned char *)str; - char *in = str; - int x; - - while (*in != '\0') { - x = *(in++); - - if (x == '%' && isxdigit(in[0]) && isxdigit(in[1])) { - x = xdigit(*(in++)) << 4; - x |= xdigit(*(in++)); - } - - *(out++) = x; - } - - *out = '\0'; -} |