Some of these date back to pre-C89.
* src/buffer.c (backspace_output):
* src/create.c (to_base256, gid_to_chars, major_to_chars)
(minor_to_chars, off_to_chars, time_to_chars, uid_to_chars):
* src/list.c (from_header, tartime):
* src/map.c (owner_map_translate, group_map_translate):
* src/system.c (sys_truncate):
* src/utf8.c (utf8_init):
* src/xattrs.c (acls_one_line):
* src/xheader.c (xheader_string_end):
Remove casts.
* src/create.c (uintmax_to_chars): Remove. All uses removed.
(simple_finish_header): Use to_octal.
return;
{
- off_t position = rmtlseek (archive, (off_t) 0, SEEK_CUR);
+ off_t position = rmtlseek (archive, 0, SEEK_CUR);
/* Seek back to the beginning of this record and start writing there. */
to_base256 (bool negative, uintmax_t value, char *where, idx_t size)
{
uintmax_t v = value;
- uintmax_t propagated_sign_bits =
- ((uintmax_t) - negative << (UINTMAX_WIDTH - LG_256));
+ uintmax_t sign_bits = - negative;
+ uintmax_t propagated_sign_bits = sign_bits << (UINTMAX_WIDTH - LG_256);
idx_t i = size;
do
static bool
gid_to_chars (gid_t v, char *p, idx_t s)
{
- return to_chars (v < 0, (uintmax_t) v, sizeof v, gid_substitute, p, s, "gid_t");
+ 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)
{
- return to_chars (v < 0, (uintmax_t) v, sizeof v, 0, p, s, "major_t");
+ 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)
{
- return to_chars (v < 0, (uintmax_t) v, sizeof v, 0, p, s, "minor_t");
+ return to_chars (v < 0, v, sizeof v, 0, p, s, "minor_t");
}
static bool
bool
off_to_chars (off_t v, char *p, idx_t s)
{
- return to_chars (v < 0, (uintmax_t) v, sizeof v, 0, p, s, "off_t");
+ 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)
{
- return to_chars (v < 0, (uintmax_t) v, sizeof v, 0, p, s, "time_t");
+ return to_chars (v < 0, v, sizeof v, 0, p, s, "time_t");
}
static uintmax_t
static bool
uid_to_chars (uid_t v, char *p, idx_t s)
{
- return to_chars (v < 0, (uintmax_t) v, sizeof v, uid_substitute, p, s, "uid_t");
-}
-
-static bool
-uintmax_to_chars (uintmax_t v, char *p, idx_t s)
-{
- return to_chars (false, v, sizeof v, 0, p, s, "uintmax_t");
+ return to_chars (v < 0, v, sizeof v, uid_substitute, p, s, "uid_t");
}
static void
This is a fast way to do:
- sprintf(header->header.chksum, "%6o", sum); */
+ sprintf (header->header.chksum, "%6o", sum); */
- uintmax_to_chars ((uintmax_t) sum, header->header.chksum, 7);
+ header->header.chksum[6] = '\0';
+ to_octal (sum, header->header.chksum, 6);
set_next_block_after (header);
}
i++;
}
dump = xmalloc (sizeof (*dump) + ctsize);
- dump->contents = (char*)(dump + 1);
+ dump->contents = (char *) (dump + 1);
memcpy (dump->contents, contents, ctsize);
dump->total = total;
dump->elc = i;
if (!overflow && value <= minus_minval)
{
if (!silent)
- paxwarn (0,
- /* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
- _("Archive octal value %.*s is out of %s range;"
- " assuming two's complement"),
- (int) (where - where1), where1, type);
+ {
+ int width = where - where1;
+ paxwarn (0,
+ /* TRANSLATORS: Second %s is a type name
+ (gid_t, uid_t, etc.). */
+ _("Archive octal value %.*s is out of %s range;"
+ " assuming two's complement"),
+ width, where1, type);
+ }
negative = true;
}
}
if (overflow)
{
if (type && !silent)
- paxerror (0,
- /* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
- _("Archive octal value %.*s is out of %s range"),
- (int) (where - where1), where1, type);
+ {
+ int width = where - where1;
+ paxerror (0,
+ /* TRANSLATORS: Second %s is a type name
+ (gid_t, uid_t, etc.). */
+ _("Archive octal value %.*s is out of %s range"),
+ width, where1, type);
+ }
return -1;
}
}
if (ckd_mul (&value, value, 64))
{
if (type && !silent)
- paxerror (0, _("Archive signed base-64 string %s is out of %s range"),
+ paxerror (0, _("Archive signed base-64 string %s"
+ " is out of %s range"),
quote_mem (where0, digs), type);
return -1;
}
always on, so that we don't confuse this format with the
others (assuming ASCII bytes of 8 bits or more). */
int signbit = *where & (1 << (LG_256 - 2));
- uintmax_t topbits = (((uintmax_t) - signbit)
- << (UINTMAX_WIDTH - LG_256 - (LG_256 - 2)));
+ uintmax_t signbits = - signbit;
+ uintmax_t topbits = signbits << (UINTMAX_WIDTH - LG_256 - (LG_256 - 2));
value = (*where++ & ((1 << (LG_256 - 2)) - 1)) - signbit;
for (;;)
{
if (((value << LG_256 >> LG_256) | topbits) != value)
{
if (type && !silent)
- paxerror (0, _("Archive base-256 value is out of %s range"), type);
+ paxerror (0, _("Archive base-256 value is out of %s range"),
+ type);
return -1;
}
}
if (type)
{
char buf[1000]; /* Big enough to represent any header. */
+ int bufsize = sizeof buf;
static struct quoting_options *o;
if (!o)
quotearg_buffer (buf, sizeof buf, where0, lim - where0, o);
if (!silent)
paxerror (0,
- /* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
- _("Archive contains %.*s where numeric %s value expected"),
- (int) sizeof buf, buf, type);
+ /* TRANSLATORS: Second %s is a type name
+ (gid_t, uid_t, etc.). */
+ _("Archive contains %.*s"
+ " where numeric %s value expected"),
+ bufsize, buf, type);
}
return -1;
is out of range. Convert it as an integer,
right-adjusted in a field with the same width as the usual
4-year ISO time format. */
- p = umaxtostr (negative ? - (uintmax_t) s : s,
+
+ uintmax_t us = s;
+ p = umaxtostr (negative ? - us : s,
buffer + sizeof buffer - UINTMAX_STRSIZE_BOUND - fraclen);
if (negative)
*--p = '-';
}
}
- if (owner_option != (uid_t) -1)
+ uid_t minus_1 = -1;
+ if (owner_option != minus_1)
{
*new_uid = owner_option;
rc = 0;
}
}
- if (group_option != (uid_t) -1)
+ gid_t minus_1 = -1;
+ if (group_option != minus_1)
{
*new_gid = group_option;
rc = 0;
int
sys_truncate (int fd)
{
- off_t pos = lseek (fd, (off_t) 0, SEEK_CUR);
+ off_t pos = lseek (fd, 0, SEEK_CUR);
return pos < 0 ? -1 : ftruncate (fd, pos);
}
switch (key)
{
default:
- s = (char*) text;
+ s = (char *) text;
break;
case 'j':
void
usage (int status)
{
- argp_help (&argp, stderr, ARGP_HELP_SEE, (char*) program_name);
+ argp_help (&argp, stderr, ARGP_HELP_SEE, (char *) program_name);
close_stdout ();
exit (status);
}
if (ws.ws_wordc)
{
int idx;
- ws.ws_wordv[0] = (char*) program_name;
+ ws.ws_wordv[0] = (char *) program_name;
save_loc_ptr = args->loc;
args->loc = &loc;
int argc;
static iconv_t
utf8_init (bool to_utf)
{
- if (conv_desc[(int) to_utf] == (iconv_t) -1)
+ if (conv_desc[to_utf] == (iconv_t) -1)
{
if (to_utf)
- conv_desc[(int) to_utf] = iconv_open ("UTF-8", locale_charset ());
+ conv_desc[to_utf] = iconv_open ("UTF-8", locale_charset ());
else
- conv_desc[(int) to_utf] = iconv_open (locale_charset (), "UTF-8");
+ conv_desc[to_utf] = iconv_open (locale_charset (), "UTF-8");
}
- return conv_desc[(int) to_utf];
+ return conv_desc[to_utf];
}
bool
obstack_1grow (&stk, '\0');
- fprintf (stdlis, "%s", (char *) obstack_finish (&stk));
+ fputs (obstack_finish (&stk), stdlis);
obstack_free (&stk, NULL);
}
uintmax_t n = 0;
char nbuf[UINTMAX_STRSIZE_BOUND];
char const *np;
- char *cp;
if (xhdr->buffer)
return false;
}
x_obstack_blank (xhdr, p);
x_obstack_1grow (xhdr, '\n');
- cp = (char*) obstack_next_free (xhdr->stk) - xhdr->string_length - p - 1;
+ char *cp = obstack_next_free (xhdr->stk);
+ cp -= xhdr->string_length + p + 1;
memmove (cp + p, cp, xhdr->string_length);
cp = stpcpy (cp, np);
*cp++ = ' ';