/* The maximum uintmax_t value that can be represented with octal
digits and a trailing NUL in a buffer of size BUFSIZE. */
static uintmax_t
-max_octal_val (idx_t bufsize)
+max_octal_val (int bufsize)
{
return max_val_with_digits (bufsize - 1, LG_8);
}
The result is undefined if SIZE is 0 or if VALUE is too large to fit. */
static void
-to_octal (uintmax_t value, char *where, idx_t size)
+to_octal (uintmax_t value, char *where, int size)
{
uintmax_t v = value;
- idx_t i = size;
+ int i = size;
do
{
NUL unless SRC is LEN or more bytes long. */
static void
-tar_copy_str (char *dst, const char *src, idx_t len)
+tar_copy_str (char *dst, const char *src, int len)
{
- for (idx_t i = 0; i < len; i++)
+ for (int i = 0; i < len; i++)
if (! (dst[i] = src[i]))
break;
}
is OLDGNU format */
static void
-tar_name_copy_str (char *dst, const char *src, idx_t len)
+tar_name_copy_str (char *dst, const char *src, int len)
{
tar_copy_str (dst, src, len);
if (archive_format == OLDGNU_FORMAT)
- dst[len-1] = 0;
+ dst[len - 1] = 0;
}
/* Convert NEGATIVE VALUE to a base-256 representation suitable for
fit. */
static void
-to_base256 (bool negative, uintmax_t value, char *where, idx_t size)
+to_base256 (bool negative, uintmax_t value, char *where, int size)
{
uintmax_t v = value;
uintmax_t sign_bits = - negative;
uintmax_t propagated_sign_bits = sign_bits << (UINTMAX_WIDTH - LG_256);
- idx_t i = size;
+ int i = size;
do
{
#define GNAME_TO_CHARS(name, buf) string_to_chars (name, buf, sizeof (buf))
static bool
-to_chars (bool negative, uintmax_t value, idx_t valsize,
+to_chars (bool negative, uintmax_t value, int valsize,
uintmax_t (*substitute) (bool *),
- char *where, idx_t size, const char *type);
+ char *where, int size, const char *type);
static bool
-to_chars_subst (bool negative, bool gnu_format, uintmax_t value, idx_t valsize,
+to_chars_subst (bool negative, bool gnu_format, uintmax_t value, int valsize,
uintmax_t (*substitute) (bool *),
- char *where, idx_t size, const char *type)
+ char *where, int size, const char *type)
{
uintmax_t maxval = (gnu_format
? max_val_with_digits (size - 1, LG_256)
substitute value is negative. */
static bool
-to_chars (bool negative, uintmax_t value, idx_t valsize,
+to_chars (bool negative, uintmax_t value, int valsize,
uintmax_t (*substitute) (bool *),
- char *where, idx_t size, const char *type)
+ char *where, int size, const char *type)
{
bool gnu_format = (archive_format == GNU_FORMAT
|| archive_format == OLDGNU_FORMAT);
}
static bool
-gid_to_chars (gid_t v, char *p, idx_t s)
+gid_to_chars (gid_t v, char *p, int s)
{
return to_chars (v < 0, v, sizeof v, gid_substitute, p, s, "gid_t");
}
static bool
-major_to_chars (major_t v, char *p, idx_t s)
+major_to_chars (major_t v, char *p, int s)
{
return to_chars (v < 0, v, sizeof v, 0, p, s, "major_t");
}
static bool
-minor_to_chars (minor_t v, char *p, idx_t s)
+minor_to_chars (minor_t v, char *p, int s)
{
return to_chars (v < 0, v, sizeof v, 0, p, s, "minor_t");
}
static bool
-mode_to_chars (mode_t v, char *p, idx_t s)
+mode_to_chars (mode_t v, char *p, int s)
{
/* In the common case where the internal and external mode bits are the same,
and we are not using POSIX or GNU format,
}
bool
-off_to_chars (off_t v, char *p, idx_t s)
+off_to_chars (off_t v, char *p, int s)
{
return to_chars (v < 0, v, sizeof v, 0, p, s, "off_t");
}
bool
-time_to_chars (time_t v, char *p, idx_t s)
+time_to_chars (time_t v, char *p, int s)
{
return to_chars (v < 0, v, sizeof v, 0, p, s, "time_t");
}
}
static bool
-uid_to_chars (uid_t v, char *p, idx_t s)
+uid_to_chars (uid_t v, char *p, int s)
{
return to_chars (v < 0, v, sizeof v, uid_substitute, p, s, "uid_t");
}
static void
-string_to_chars (char const *str, char *p, idx_t s)
+string_to_chars (char const *str, char *p, int s)
{
tar_copy_str (p, str, s);
p[s - 1] = '\0';
set_next_block_after (header + (size - 1) / BLOCKSIZE);
}
-static idx_t
+static int
split_long_name (const char *name, idx_t length)
{
- idx_t i;
+ int i;
if (length > PREFIX_FIELD_SIZE + 1)
length = PREFIX_FIELD_SIZE + 1;
return NULL;
}
- idx_t i = split_long_name (name, length), nlen;
- if (i == 0 || (nlen = length - i - 1) > NAME_FIELD_SIZE || nlen == 0)
+ int i = split_long_name (name, length);
+ idx_t nlen = length - i - 1;
+ if (i == 0 || ! (0 < nlen && nlen <= NAME_FIELD_SIZE))
{
paxerror (0, _("%s: file name is too long (cannot be split); not dumped"),
quotearg_colon (name));
int sum = 0;
char *p = header->buffer;
- for (idx_t i = sizeof *header; i-- != 0; )
+ for (int i = sizeof *header; i-- != 0; )
/* We can't use unsigned char here because of old compilers, e.g. V7. */
sum += 0xFF & *p++;
#define TIME_FROM_HEADER(where) time_from_header (where, sizeof (where))
#define UID_FROM_HEADER(where) uid_from_header (where, sizeof (where))
-static gid_t gid_from_header (const char *buf, idx_t size);
-static major_t major_from_header (const char *buf, idx_t size);
-static minor_t minor_from_header (const char *buf, idx_t size);
-static mode_t mode_from_header (const char *buf, idx_t size, bool *hbits);
-static time_t time_from_header (const char *buf, idx_t size);
-static uid_t uid_from_header (const char *buf, idx_t size);
-static intmax_t from_header (const char *, idx_t, const char *,
+static gid_t gid_from_header (const char *buf, int size);
+static major_t major_from_header (const char *buf, int size);
+static minor_t minor_from_header (const char *buf, int size);
+static mode_t mode_from_header (const char *buf, int size, bool *hbits);
+static time_t time_from_header (const char *buf, int size);
+static uid_t uid_from_header (const char *buf, int size);
+static intmax_t from_header (const char *, int, const char *,
intmax_t, uintmax_t, bool, bool);
/* Table of base-64 digit values + 1, indexed by unsigned chars.
numbers instead of the other GNU extensions. Return -1 on error,
diagnosing the error if TYPE is nonnull and if !SILENT. */
static intmax_t
-from_header (char const *where0, idx_t digs, char const *type,
+from_header (char const *where0, int digs, char const *type,
intmax_t minval, uintmax_t maxval,
bool octal_only, bool silent)
{
}
static gid_t
-gid_from_header (const char *p, idx_t s)
+gid_from_header (const char *p, int s)
{
return from_header (p, s, "gid_t",
TYPE_MINIMUM (gid_t), TYPE_MAXIMUM (gid_t),
}
static major_t
-major_from_header (const char *p, idx_t s)
+major_from_header (const char *p, int s)
{
return from_header (p, s, "major_t",
TYPE_MINIMUM (major_t), TYPE_MAXIMUM (major_t),
}
static minor_t
-minor_from_header (const char *p, idx_t s)
+minor_from_header (const char *p, int s)
{
return from_header (p, s, "minor_t",
TYPE_MINIMUM (minor_t), TYPE_MAXIMUM (minor_t),
/* Convert P to the file mode, as understood by tar.
Set *HBITS if there are any unrecognized bits. */
static mode_t
-mode_from_header (const char *p, idx_t s, bool *hbits)
+mode_from_header (const char *p, int s, bool *hbits)
{
intmax_t u = from_header (p, s, "mode_t",
INTMAX_MIN, UINTMAX_MAX,
}
off_t
-off_from_header (const char *p, idx_t s)
+off_from_header (const char *p, int s)
{
/* Negative offsets are not allowed in tar files, so invoke
from_header with minimum value 0, not TYPE_MINIMUM (off_t). */
}
static time_t
-time_from_header (const char *p, idx_t s)
+time_from_header (const char *p, int s)
{
return from_header (p, s, "time_t",
TYPE_MINIMUM (time_t), TYPE_MAXIMUM (time_t),
}
static uid_t
-uid_from_header (const char *p, idx_t s)
+uid_from_header (const char *p, int s)
{
return from_header (p, s, "uid_t",
TYPE_MINIMUM (uid_t), TYPE_MAXIMUM (uid_t),