summaryrefslogtreecommitdiff
path: root/lib/tar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tar')
-rw-r--r--lib/tar/base64.c4
-rw-r--r--lib/tar/checksum.c2
-rw-r--r--lib/tar/internal.h10
-rw-r--r--lib/tar/number.c14
-rw-r--r--lib/tar/read_header.c22
-rw-r--r--lib/tar/read_sparse_map_old.c2
-rw-r--r--lib/tar/skip.c6
-rw-r--r--lib/tar/write_header.c12
8 files changed, 36 insertions, 36 deletions
diff --git a/lib/tar/base64.c b/lib/tar/base64.c
index edb2d61..0ccf3c4 100644
--- a/lib/tar/base64.c
+++ b/lib/tar/base64.c
@@ -8,7 +8,7 @@
#include "internal.h"
-static uint8_t convert(char in)
+static sqfs_u8 convert(char in)
{
if (isupper(in))
return in - 'A';
@@ -23,7 +23,7 @@ static uint8_t convert(char in)
return 0;
}
-void base64_decode(uint8_t *out, const char *in)
+void base64_decode(sqfs_u8 *out, const char *in)
{
char temp[4];
diff --git a/lib/tar/checksum.c b/lib/tar/checksum.c
index 6bbe5d8..144ba43 100644
--- a/lib/tar/checksum.c
+++ b/lib/tar/checksum.c
@@ -38,7 +38,7 @@ void update_checksum(tar_header_t *hdr)
bool is_checksum_valid(const tar_header_t *hdr)
{
unsigned int calculated_chksum = get_checksum(hdr);
- uint64_t read_chksum;
+ sqfs_u64 read_chksum;
if (read_octal(hdr->chksum, sizeof(hdr->chksum), &read_chksum))
return 0;
diff --git a/lib/tar/internal.h b/lib/tar/internal.h
index d95ef52..f30de29 100644
--- a/lib/tar/internal.h
+++ b/lib/tar/internal.h
@@ -43,13 +43,13 @@ enum {
#define TAR_MAX_PAX_LEN (65536)
-int read_octal(const char *str, int digits, uint64_t *out);
+int read_octal(const char *str, int digits, sqfs_u64 *out);
-int read_binary(const char *str, int digits, uint64_t *out);
+int read_binary(const char *str, int digits, sqfs_u64 *out);
-int read_number(const char *str, int digits, uint64_t *out);
+int read_number(const char *str, int digits, sqfs_u64 *out);
-int pax_read_decimal(const char *str, uint64_t *out);
+int pax_read_decimal(const char *str, sqfs_u64 *out);
void update_checksum(tar_header_t *hdr);
@@ -63,7 +63,7 @@ void free_sparse_list(sparse_map_t *sparse);
void free_xattr_list(tar_xattr_t *list);
-void base64_decode(uint8_t *out, const char *in);
+void base64_decode(sqfs_u8 *out, const char *in);
void urldecode(char *str);
diff --git a/lib/tar/number.c b/lib/tar/number.c
index e2a3dd4..06d5317 100644
--- a/lib/tar/number.c
+++ b/lib/tar/number.c
@@ -8,9 +8,9 @@
#include "internal.h"
-int read_octal(const char *str, int digits, uint64_t *out)
+int read_octal(const char *str, int digits, sqfs_u64 *out)
{
- uint64_t result = 0;
+ sqfs_u64 result = 0;
while (digits > 0 && isspace(*str)) {
++str;
@@ -31,9 +31,9 @@ int read_octal(const char *str, int digits, uint64_t *out)
return 0;
}
-int read_binary(const char *str, int digits, uint64_t *out)
+int read_binary(const char *str, int digits, sqfs_u64 *out)
{
- uint64_t x, ov, result = 0;
+ sqfs_u64 x, ov, result = 0;
bool first = true;
while (digits > 0) {
@@ -67,7 +67,7 @@ fail_ov:
return -1;
}
-int read_number(const char *str, int digits, uint64_t *out)
+int read_number(const char *str, int digits, sqfs_u64 *out)
{
if (*((unsigned char *)str) & 0x80)
return read_binary(str, digits, out);
@@ -75,9 +75,9 @@ int read_number(const char *str, int digits, uint64_t *out)
return read_octal(str, digits, out);
}
-int pax_read_decimal(const char *str, uint64_t *out)
+int pax_read_decimal(const char *str, sqfs_u64 *out)
{
- uint64_t result = 0;
+ sqfs_u64 result = 0;
while (*str >= '0' && *str <= '9') {
if (result > 0xFFFFFFFFFFFFFFFFUL / 10) {
diff --git a/lib/tar/read_header.c b/lib/tar/read_header.c
index 63de699..f6d746b 100644
--- a/lib/tar/read_header.c
+++ b/lib/tar/read_header.c
@@ -35,7 +35,7 @@ static int check_version(const tar_header_t *hdr)
return ETV_UNKNOWN;
}
-static char *record_to_memory(int fd, uint64_t size)
+static char *record_to_memory(int fd, sqfs_u64 size)
{
char *buffer = malloc(size + 1);
@@ -74,14 +74,14 @@ static tar_xattr_t *mkxattr(const char *key, size_t keylen,
return xattr;
}
-static int read_pax_header(int fd, uint64_t entsize, unsigned int *set_by_pax,
+static int read_pax_header(int fd, sqfs_u64 entsize, unsigned int *set_by_pax,
tar_header_decoded_t *out)
{
sparse_map_t *sparse_last = NULL, *sparse;
- uint64_t field, offset = 0, num_bytes = 0;
+ sqfs_u64 field, offset = 0, num_bytes = 0;
char *buffer, *line, *key, *ptr, *value;
tar_xattr_t *xattr;
- uint64_t i;
+ sqfs_u64 i;
buffer = record_to_memory(fd, entsize);
if (buffer == NULL)
@@ -134,7 +134,7 @@ static int read_pax_header(int fd, uint64_t entsize, unsigned int *set_by_pax,
if (line[6] == '-') {
if (pax_read_decimal(line + 7, &field))
goto fail;
- out->mtime = -((int64_t)field);
+ out->mtime = -((sqfs_s64)field);
} else {
if (pax_read_decimal(line + 6, &field))
goto fail;
@@ -205,7 +205,7 @@ static int read_pax_header(int fd, uint64_t entsize, unsigned int *set_by_pax,
goto fail_errno;
urldecode(xattr->key);
- base64_decode((uint8_t *)xattr->value, value);
+ base64_decode((sqfs_u8 *)xattr->value, value);
xattr->next = out->xattr;
out->xattr = xattr;
@@ -226,7 +226,7 @@ static int decode_header(const tar_header_t *hdr, unsigned int set_by_pax,
tar_header_decoded_t *out, int version)
{
size_t len1, len2;
- uint64_t field;
+ sqfs_u64 field;
if (!(set_by_pax & PAX_NAME)) {
if (hdr->tail.posix.prefix[0] != '\0' &&
@@ -289,7 +289,7 @@ static int decode_header(const tar_header_t *hdr, unsigned int set_by_pax,
return -1;
if (field & 0x8000000000000000UL) {
field = ~field + 1;
- out->mtime = -((int64_t)field);
+ out->mtime = -((sqfs_s64)field);
} else {
out->mtime = field;
}
@@ -344,9 +344,9 @@ static int decode_header(const tar_header_t *hdr, unsigned int set_by_pax,
}
#if SIZEOF_TIME_T < 8
- if (out->mtime > (int64_t)INT32_MAX) {
+ if (out->mtime > (sqfs_s64)INT32_MAX) {
out->sb.st_mtime = INT32_MAX;
- } else if (out->mtime < (int64_t)INT32_MIN) {
+ } else if (out->mtime < (sqfs_s64)INT32_MIN) {
out->sb.st_mtime = INT32_MIN;
} else {
out->sb.st_mtime = out->mtime;
@@ -361,7 +361,7 @@ int read_header(int fd, tar_header_decoded_t *out)
{
unsigned int set_by_pax = 0;
bool prev_was_zero = false;
- uint64_t pax_size;
+ sqfs_u64 pax_size;
tar_header_t hdr;
int version;
diff --git a/lib/tar/read_sparse_map_old.c b/lib/tar/read_sparse_map_old.c
index 5891bdb..fb79eca 100644
--- a/lib/tar/read_sparse_map_old.c
+++ b/lib/tar/read_sparse_map_old.c
@@ -12,7 +12,7 @@ sparse_map_t *read_gnu_old_sparse(int fd, tar_header_t *hdr)
{
sparse_map_t *list = NULL, *end = NULL, *node;
gnu_sparse_t sph;
- uint64_t off, sz;
+ sqfs_u64 off, sz;
int i;
for (i = 0; i < 4; ++i) {
diff --git a/lib/tar/skip.c b/lib/tar/skip.c
index 3cdfb8b..eb91416 100644
--- a/lib/tar/skip.c
+++ b/lib/tar/skip.c
@@ -11,7 +11,7 @@
#include <stdio.h>
-static int skip_bytes(int fd, uint64_t size)
+static int skip_bytes(int fd, sqfs_u64 size)
{
unsigned char buffer[1024];
size_t diff;
@@ -30,14 +30,14 @@ static int skip_bytes(int fd, uint64_t size)
return 0;
}
-int skip_padding(int fd, uint64_t size)
+int skip_padding(int fd, sqfs_u64 size)
{
size_t tail = size % 512;
return tail ? skip_bytes(fd, 512 - tail) : 0;
}
-int skip_entry(int fd, uint64_t size)
+int skip_entry(int fd, sqfs_u64 size)
{
size_t tail = size % 512;
diff --git a/lib/tar/write_header.c b/lib/tar/write_header.c
index d3a184a..4c8caa2 100644
--- a/lib/tar/write_header.c
+++ b/lib/tar/write_header.c
@@ -8,7 +8,7 @@
#include "internal.h"
-static void write_binary(char *dst, uint64_t value, int digits)
+static void write_binary(char *dst, sqfs_u64 value, int digits)
{
memset(dst, 0, digits);
@@ -21,9 +21,9 @@ static void write_binary(char *dst, uint64_t value, int digits)
((unsigned char *)dst)[0] |= 0x80;
}
-static void write_number(char *dst, uint64_t value, int digits)
+static void write_number(char *dst, sqfs_u64 value, int digits)
{
- uint64_t mask = 0;
+ sqfs_u64 mask = 0;
char buffer[64];
int i;
@@ -41,9 +41,9 @@ static void write_number(char *dst, uint64_t value, int digits)
}
}
-static void write_number_signed(char *dst, int64_t value, int digits)
+static void write_number_signed(char *dst, sqfs_s64 value, int digits)
{
- uint64_t neg;
+ sqfs_u64 neg;
if (value < 0) {
neg = -value;
@@ -57,7 +57,7 @@ static int write_header(int fd, const struct stat *sb, const char *name,
const char *slink_target, int type)
{
int maj = 0, min = 0;
- uint64_t size = 0;
+ sqfs_u64 size = 0;
tar_header_t hdr;
if (S_ISCHR(sb->st_mode) || S_ISBLK(sb->st_mode)) {