summaryrefslogtreecommitdiff
path: root/lib/tar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tar')
-rw-r--r--lib/tar/internal.h1
-rw-r--r--lib/tar/pax_header.c16
2 files changed, 4 insertions, 13 deletions
diff --git a/lib/tar/internal.h b/lib/tar/internal.h
index cfbb938..c5483fe 100644
--- a/lib/tar/internal.h
+++ b/lib/tar/internal.h
@@ -11,6 +11,7 @@
#include "tar/tar.h"
#include "tar/format.h"
+#include "util/util.h"
enum {
PAX_SIZE = 0x001,
diff --git a/lib/tar/pax_header.c b/lib/tar/pax_header.c
index 8a1b077..cc2f2b0 100644
--- a/lib/tar/pax_header.c
+++ b/lib/tar/pax_header.c
@@ -26,15 +26,6 @@ static sqfs_u8 base64_convert(char in)
return 0;
}
-static int xdigit(int x)
-{
- if (isupper(x))
- return x - 'A' + 0x0A;
- if (islower(x))
- return x - 'a' + 0x0A;
- return x - '0';
-}
-
static size_t base64_decode(sqfs_u8 *out, const char *in, size_t len)
{
sqfs_u8 *start = out;
@@ -91,14 +82,13 @@ static void urldecode(char *str)
{
unsigned char *out = (unsigned char *)str;
char *in = str;
- int x;
while (*in != '\0') {
- x = *(in++);
+ sqfs_u8 x = *(in++);
if (x == '%' && isxdigit(in[0]) && isxdigit(in[1])) {
- x = xdigit(*(in++)) << 4;
- x |= xdigit(*(in++));
+ hex_decode(in, 2, &x, 1);
+ in += 2;
}
*(out++) = x;