Skip to content
Browse files

Fix build failure with -Wshadow GCC option since it happend on FreeBS…

…D current.
  • Loading branch information...
1 parent 433f74b commit fc22f4a623faf980919b5bebc634b797e0d37644 @ggcueroad ggcueroad committed Feb 9, 2012
View
22 cpio/test/main.c
@@ -2637,25 +2637,25 @@ main(int argc, char **argv)
} else {
while (*(argv) != NULL) {
if (**argv >= '0' && **argv <= '9') {
- char *p = *argv;
+ char *vp = *argv;
start = 0;
- while (*p >= '0' && *p <= '9') {
+ while (*vp >= '0' && *vp <= '9') {
start *= 10;
- start += *p - '0';
- ++p;
+ start += *vp - '0';
+ ++vp;
}
- if (*p == '\0') {
+ if (*vp == '\0') {
end = start;
- } else if (*p == '-') {
- ++p;
- if (*p == '\0') {
+ } else if (*vp == '-') {
+ ++vp;
+ if (*vp == '\0') {
end = limit - 1;
} else {
end = 0;
- while (*p >= '0' && *p <= '9') {
+ while (*vp >= '0' && *vp <= '9') {
end *= 10;
- end += *p - '0';
- ++p;
+ end += *vp - '0';
+ ++vp;
}
}
} else {
View
12 libarchive/archive_acl.c
@@ -65,7 +65,7 @@ static int isint(const char *start, const char *end, int *result);
static int ismode(const char *start, const char *end, int *result);
static void next_field(const char **p, const char **start,
const char **end, char *sep);
-static int prefix(const char *start, const char *end,
+static int prefix_c(const char *start, const char *end,
const char *test);
static void append_entry(char **p, const char *prefix, int tag,
const char *name, int perm, int id);
@@ -1099,23 +1099,23 @@ archive_acl_parse_l(struct archive_acl *acl,
type = default_type;
name.start = name.end = NULL;
- if (prefix(field[0].start, field[0].end, "user")) {
+ if (prefix_c(field[0].start, field[0].end, "user")) {
if (!ismode(field[2].start, field[2].end, &permset))
return (ARCHIVE_WARN);
if (id != -1 || field[1].start < field[1].end) {
tag = ARCHIVE_ENTRY_ACL_USER;
name = field[1];
} else
tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
- } else if (prefix(field[0].start, field[0].end, "group")) {
+ } else if (prefix_c(field[0].start, field[0].end, "group")) {
if (!ismode(field[2].start, field[2].end, &permset))
return (ARCHIVE_WARN);
if (id != -1 || field[1].start < field[1].end) {
tag = ARCHIVE_ENTRY_ACL_GROUP;
name = field[1];
} else
tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
- } else if (prefix(field[0].start, field[0].end, "other")) {
+ } else if (prefix_c(field[0].start, field[0].end, "other")) {
if (fields == 2
&& field[1].start < field[1].end
&& ismode(field[1].start, field[1].end, &permset)) {
@@ -1128,7 +1128,7 @@ archive_acl_parse_l(struct archive_acl *acl,
} else
return (ARCHIVE_WARN);
tag = ARCHIVE_ENTRY_ACL_OTHER;
- } else if (prefix(field[0].start, field[0].end, "mask")) {
+ } else if (prefix_c(field[0].start, field[0].end, "mask")) {
if (fields == 2
&& field[1].start < field[1].end
&& ismode(field[1].start, field[1].end, &permset)) {
@@ -1257,7 +1257,7 @@ next_field(const char **p, const char **start,
* This makes it easy to handle the obvious abbreviations: 'u' for 'user', etc.
*/
static int
-prefix(const char *start, const char *end, const char *test)
+prefix_c(const char *start, const char *end, const char *test)
{
if (start == end)
return (0);
View
25 libarchive/archive_match.c
@@ -896,26 +896,26 @@ set_timefilter(struct archive_match *a, int timetype,
static int
set_timefilter_date(struct archive_match *a, int timetype, const char *datestr)
{
- time_t time;
+ time_t t;
if (datestr == NULL || *datestr == '\0') {
archive_set_error(&(a->archive), EINVAL, "date is empty");
return (ARCHIVE_FAILED);
}
- time = get_date(a->now, datestr);
- if (time == (time_t)-1) {
+ t = get_date(a->now, datestr);
+ if (t == (time_t)-1) {
archive_set_error(&(a->archive), EINVAL, "invalid date string");
return (ARCHIVE_FAILED);
}
- return set_timefilter(a, timetype, time, 0, time, 0);
+ return set_timefilter(a, timetype, t, 0, t, 0);
}
static int
set_timefilter_date_w(struct archive_match *a, int timetype,
const wchar_t *datestr)
{
struct archive_string as;
- time_t time;
+ time_t t;
if (datestr == NULL || *datestr == L'\0') {
archive_set_error(&(a->archive), EINVAL, "date is empty");
@@ -931,13 +931,13 @@ set_timefilter_date_w(struct archive_match *a, int timetype,
"Failed to convert WCS to MBS");
return (ARCHIVE_FAILED);
}
- time = get_date(a->now, as.s);
+ t = get_date(a->now, as.s);
archive_string_free(&as);
- if (time == (time_t)-1) {
+ if (t == (time_t)-1) {
archive_set_error(&(a->archive), EINVAL, "invalid date string");
return (ARCHIVE_FAILED);
}
- return set_timefilter(a, timetype, time, 0, time, 0);
+ return set_timefilter(a, timetype, t, 0, t, 0);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -1029,19 +1029,20 @@ static int
set_timefilter_stat(struct archive_match *a, int timetype, struct stat *st)
{
struct archive_entry *ae;
- time_t ctime, mtime;
+ time_t ctime_sec, mtime_sec;
long ctime_ns, mtime_ns;
ae = archive_entry_new();
if (ae == NULL)
return (error_nomem(a));
archive_entry_copy_stat(ae, st);
- ctime = archive_entry_ctime(ae);
+ ctime_sec = archive_entry_ctime(ae);
ctime_ns = archive_entry_ctime_nsec(ae);
- mtime = archive_entry_mtime(ae);
+ mtime_sec = archive_entry_mtime(ae);
mtime_ns = archive_entry_mtime_nsec(ae);
archive_entry_free(ae);
- return set_timefilter(a, timetype, mtime, mtime_ns, ctime, ctime_ns);
+ return set_timefilter(a, timetype, mtime_sec, mtime_ns,
+ ctime_sec, ctime_ns);
}
static int
View
4 libarchive/archive_ppmd_private.h
@@ -152,7 +152,7 @@ typedef
CPpmd_Byte_Ref;
#define PPMD_SetAllBitsIn256Bytes(p) \
- { unsigned i; for (i = 0; i < 256 / sizeof(p[0]); i += 8) { \
- p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }}
+ { unsigned j; for (j = 0; j < 256 / sizeof(p[0]); j += 8) { \
+ p[j+7] = p[j+6] = p[j+5] = p[j+4] = p[j+3] = p[j+2] = p[j+1] = p[j+0] = ~(size_t)0; }}
#endif
View
25 libarchive/archive_read_support_format_7zip.c
@@ -646,7 +646,6 @@ archive_read_format_7zip_read_header(struct archive_read *a,
if ((zip_entry->mode & AE_IFMT) == AE_IFLNK) {
unsigned char *symname = NULL;
size_t symsize = 0;
- int r;
/*
* Symbolic-name is recorded as its contents. We have to
@@ -2532,17 +2531,17 @@ read_Header(struct archive_read *a, struct _7z_header_info *h,
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
static void
-fileTimeToUtc(uint64_t fileTime, time_t *time, long *ns)
+fileTimeToUtc(uint64_t fileTime, time_t *timep, long *ns)
{
if (fileTime >= EPOC_TIME) {
fileTime -= EPOC_TIME;
/* milli seconds base */
- *time = (time_t)(fileTime / 10000000);
+ *timep = (time_t)(fileTime / 10000000);
/* nano seconds base */
*ns = (long)(fileTime % 10000000) * 100;
} else {
- *time = 0;
+ *timep = 0;
*ns = 0;
}
}
@@ -3521,16 +3520,16 @@ x86_Convert(struct _7zip *zip, uint8_t *data, size_t size)
uint32_t dest;
for (;;) {
uint8_t b;
- int index;
+ int b_index;
dest = src - (ip + (uint32_t)bufferPos);
if (prevMask == 0)
break;
- index = kMaskToBitNumber[prevMask] * 8;
- b = (uint8_t)(dest >> (24 - index));
+ b_index = kMaskToBitNumber[prevMask] * 8;
+ b = (uint8_t)(dest >> (24 - b_index));
if (!Test86MSByte(b))
break;
- src = dest ^ ((1 << (32 - index)) - 1);
+ src = dest ^ ((1 << (32 - b_index)) - 1);
}
p[4] = (uint8_t)(~(((dest >> 24) & 1) - 1));
p[3] = (uint8_t)(dest >> 16);
@@ -3571,7 +3570,7 @@ x86_Convert(struct _7zip *zip, uint8_t *data, size_t size)
#define RC_READ_BYTE (*buffer++)
#define RC_TEST { if (buffer == bufferLim) return SZ_ERROR_DATA; }
#define RC_INIT2 zip->bcj2_code = 0; zip->bcj2_range = 0xFFFFFFFF; \
- { int i; for (i = 0; i < 5; i++) { RC_TEST; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; }}
+ { int ii; for (ii = 0; ii < 5; ii++) { RC_TEST; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; }}
#define NORMALIZE if (zip->bcj2_range < kTopValue) { RC_TEST; zip->bcj2_range <<= 8; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; }
@@ -3637,14 +3636,14 @@ Bcj2_Decode(struct _7zip *zip, uint8_t *outBuf, size_t outSize)
if (zip->bcj_state == 1) {
while (limit != 0) {
- uint8_t b = buf0[inPos];
- outBuf[outPos++] = b;
- if (IsJ(zip->bcj2_prevByte, b)) {
+ uint8_t bb = buf0[inPos];
+ outBuf[outPos++] = bb;
+ if (IsJ(zip->bcj2_prevByte, bb)) {
zip->bcj_state = 2;
break;
}
inPos++;
- zip->bcj2_prevByte = b;
+ zip->bcj2_prevByte = bb;
limit--;
}
}
View
26 libarchive/archive_read_support_format_rar.c
@@ -1021,7 +1021,7 @@ read_header(struct archive_read *a, struct archive_entry *entry,
char *strp;
char packed_size[8];
char unp_size[8];
- int time;
+ int ttime;
struct archive_string_conv *sconv, *fn_sconv;
unsigned long crc32_val;
int ret = (ARCHIVE_OK), ret2;
@@ -1100,8 +1100,8 @@ read_header(struct archive_read *a, struct archive_entry *entry,
rar->compression_method = file_header.method;
- time = archive_le32dec(file_header.file_time);
- rar->mtime = get_time(time);
+ ttime = archive_le32dec(file_header.file_time);
+ rar->mtime = get_time(ttime);
rar->file_crc = archive_le32dec(file_header.file_crc);
@@ -1381,15 +1381,15 @@ read_header(struct archive_read *a, struct archive_entry *entry,
}
static time_t
-get_time(int time)
+get_time(int ttime)
{
struct tm tm;
- tm.tm_sec = 2 * (time & 0x1f);
- tm.tm_min = (time >> 5) & 0x3f;
- tm.tm_hour = (time >> 11) & 0x1f;
- tm.tm_mday = (time >> 16) & 0x1f;
- tm.tm_mon = ((time >> 21) & 0x0f) - 1;
- tm.tm_year = ((time >> 25) & 0x7f) + 80;
+ tm.tm_sec = 2 * (ttime & 0x1f);
+ tm.tm_min = (ttime >> 5) & 0x3f;
+ tm.tm_hour = (ttime >> 11) & 0x1f;
+ tm.tm_mday = (ttime >> 16) & 0x1f;
+ tm.tm_mon = ((ttime >> 21) & 0x0f) - 1;
+ tm.tm_year = ((ttime >> 25) & 0x7f) + 80;
tm.tm_isdst = -1;
return mktime(&tm);
}
@@ -1398,7 +1398,7 @@ static int
read_exttime(const char *p, struct rar *rar, const char *endp)
{
unsigned rmode, flags, rem, j, count;
- int time, i;
+ int ttime, i;
struct tm *tm;
time_t t;
long nsec;
@@ -1420,8 +1420,8 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
{
if (p + 4 > endp)
return (-1);
- time = archive_le32dec(p);
- t = get_time(time);
+ ttime = archive_le32dec(p);
+ t = get_time(ttime);
p += 4;
}
rem = 0;
View
14 libarchive/archive_write_disk_posix.c
@@ -2068,7 +2068,7 @@ set_times(struct archive_write_disk *a,
time_t atime, long atime_nanos,
time_t birthtime, long birthtime_nanos,
time_t mtime, long mtime_nanos,
- time_t ctime, long ctime_nanos)
+ time_t cctime, long ctime_nanos)
{
/* Note: set_time doesn't use libarchive return conventions!
* It uses syscall conventions. So 0 here instead of ARCHIVE_OK. */
@@ -2083,11 +2083,11 @@ set_times(struct archive_write_disk *a,
if (a->user_uid == 0 &&
set_time_tru64(fd, mode, name,
atime, atime_nanos, mtime,
- mtime_nanos, ctime, ctime_nanos) == 0) {
+ mtime_nanos, cctime, ctime_nanos) == 0) {
return (ARCHIVE_OK);
}
#else /* Tru64 */
- (void)ctime; /* UNUSED */
+ (void)cctime; /* UNUSED */
(void)ctime_nanos; /* UNUSED */
#endif /* Tru64 */
@@ -2120,11 +2120,11 @@ set_times(struct archive_write_disk *a,
static int
set_times_from_entry(struct archive_write_disk *a)
{
- time_t atime, birthtime, mtime, ctime;
+ time_t atime, birthtime, mtime, cctime;
long atime_nsec, birthtime_nsec, mtime_nsec, ctime_nsec;
/* Suitable defaults. */
- atime = birthtime = mtime = ctime = a->start_time;
+ atime = birthtime = mtime = cctime = a->start_time;
atime_nsec = birthtime_nsec = mtime_nsec = ctime_nsec = 0;
/* If no time was provided, we're done. */
@@ -2148,15 +2148,15 @@ set_times_from_entry(struct archive_write_disk *a)
mtime_nsec = archive_entry_mtime_nsec(a->entry);
}
if (archive_entry_ctime_is_set(a->entry)) {
- ctime = archive_entry_ctime(a->entry);
+ cctime = archive_entry_ctime(a->entry);
ctime_nsec = archive_entry_ctime_nsec(a->entry);
}
return set_times(a, a->fd, a->mode, a->name,
atime, atime_nsec,
birthtime, birthtime_nsec,
mtime, mtime_nsec,
- ctime, ctime_nsec);
+ cctime, ctime_nsec);
}
static int
View
4 libarchive/archive_write_set_format_7zip.c
@@ -1130,11 +1130,11 @@ make_streamsInfo(struct archive_write *a, uint64_t offset, uint64_t pack_size,
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
static uint64_t
-utcToFiletime(time_t time, long ns)
+utcToFiletime(time_t t, long ns)
{
uint64_t fileTime;
- fileTime = time;
+ fileTime = t;
fileTime *= 10000000;
fileTime += ns / 100;
fileTime += EPOC_TIME;
View
3 libarchive/archive_write_set_format_iso9660.c
@@ -4508,8 +4508,7 @@ write_file_descriptors(struct archive_write *a)
/* Write the boot file contents. */
if (iso9660->el_torito.boot != NULL) {
- struct isofile *file = iso9660->el_torito.boot->file;
-
+ file = iso9660->el_torito.boot->file;
blocks = file->content.blocks;
offset = file->content.offset_of_temp;
if (offset != 0) {
View
22 libarchive/test/main.c
@@ -2635,25 +2635,25 @@ main(int argc, char **argv)
} else {
while (*(argv) != NULL) {
if (**argv >= '0' && **argv <= '9') {
- char *p = *argv;
+ char *vp = *argv;
start = 0;
- while (*p >= '0' && *p <= '9') {
+ while (*vp >= '0' && *vp <= '9') {
start *= 10;
- start += *p - '0';
- ++p;
+ start += *vp - '0';
+ ++vp;
}
- if (*p == '\0') {
+ if (*vp == '\0') {
end = start;
- } else if (*p == '-') {
- ++p;
- if (*p == '\0') {
+ } else if (*vp == '-') {
+ ++vp;
+ if (*vp == '\0') {
end = limit - 1;
} else {
end = 0;
- while (*p >= '0' && *p <= '9') {
+ while (*vp >= '0' && *vp <= '9') {
end *= 10;
- end += *p - '0';
- ++p;
+ end += *vp - '0';
+ ++vp;
}
}
} else {
View
2 libarchive/test/test_read_uu.c
@@ -95,9 +95,9 @@ test_read_uu_sub(const char *uudata, size_t uusize, int no_nl)
if (buff == NULL)
return;
for (extra = 0; extra <= 64; extra = extra==0?1:extra*2) {
- size_t size = extra * 1024;
char *p = buff;
+ size = extra * 1024;
/* Add extra text size of which is from 1K bytes to
* 64Kbytes before uuencoded data. */
while (size) {
View
8 libarchive/test/test_write_format_iso9660_filename.c
@@ -98,13 +98,13 @@ verify_file(struct archive *a, enum vtype type, struct fns *fns)
for (i = 0; i < fns->cnt; i++) {
const char *p;
const char *pathname = archive_entry_pathname(ae);
- const char *symlink = archive_entry_symlink(ae);
+ const char *symlinkname = archive_entry_symlink(ae);
size_t length;
- if (symlink != NULL) {
- length = strlen(symlink);
+ if (symlinkname != NULL) {
+ length = strlen(symlinkname);
assert(length == 1 || length == 128 || length == 255);
- assertEqualInt(symlink[length-1], 'x');
+ assertEqualInt(symlinkname[length-1], 'x');
}
failure("Found duplicate for %s", pathname);
assert(strcmp(fns->names[i], pathname) != 0);
View
22 tar/test/main.c
@@ -2637,25 +2637,25 @@ main(int argc, char **argv)
} else {
while (*(argv) != NULL) {
if (**argv >= '0' && **argv <= '9') {
- char *p = *argv;
+ char *vp = *argv;
start = 0;
- while (*p >= '0' && *p <= '9') {
+ while (*vp >= '0' && *vp <= '9') {
start *= 10;
- start += *p - '0';
- ++p;
+ start += *vp - '0';
+ ++vp;
}
- if (*p == '\0') {
+ if (*vp == '\0') {
end = start;
- } else if (*p == '-') {
- ++p;
- if (*p == '\0') {
+ } else if (*vp == '-') {
+ ++vp;
+ if (*vp == '\0') {
end = limit - 1;
} else {
end = 0;
- while (*p >= '0' && *p <= '9') {
+ while (*vp >= '0' && *vp <= '9') {
end *= 10;
- end += *p - '0';
- ++p;
+ end += *vp - '0';
+ ++vp;
}
}
} else {

0 comments on commit fc22f4a

Please sign in to comment.
Something went wrong with that request. Please try again.