]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure with -Wshadow GCC option since it happend on FreeBSD current.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 8 Feb 2012 22:55:10 +0000 (07:55 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 8 Feb 2012 22:55:10 +0000 (07:55 +0900)
13 files changed:
cpio/test/main.c
libarchive/archive_acl.c
libarchive/archive_match.c
libarchive/archive_ppmd_private.h
libarchive/archive_read_support_format_7zip.c
libarchive/archive_read_support_format_rar.c
libarchive/archive_write_disk_posix.c
libarchive/archive_write_set_format_7zip.c
libarchive/archive_write_set_format_iso9660.c
libarchive/test/main.c
libarchive/test/test_read_uu.c
libarchive/test/test_write_format_iso9660_filename.c
tar/test/main.c

index 8234eaff046fcfb4bdd769b029e23d93b0f6c326..bebd60c5c74a086b2735c7cd5cc6ca6f9a42ad1a 100644 (file)
@@ -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 {
index f9ec4a238e598630b365fa72d51a9c506afecf9e..a09faaee7fe31dff3e5541eb8bfdab096898b656 100644 (file)
@@ -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,7 +1099,7 @@ 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) {
@@ -1107,7 +1107,7 @@ archive_acl_parse_l(struct archive_acl *acl,
                                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) {
@@ -1115,7 +1115,7 @@ archive_acl_parse_l(struct archive_acl *acl,
                                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);
index 5c86d3195de3f5c5513f82ee5ddaa7606558085a..32cdbc8ccc9fdebe91eccf1e37de477b510dc8df 100644 (file)
@@ -896,18 +896,18 @@ 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
@@ -915,7 +915,7 @@ 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
index 26667687855740dead57d4d9dfb08c708c25b080..e78bde5940596a438c3d191ff739781823decde7 100644 (file)
@@ -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
index ee0c136441d17231e46e6126b2ac49962f809df8..8f73ba9f40fe9e92ac513a853aa2fe179287926f 100644 (file)
@@ -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--;
                        }
                }
index 192697af0b776205762addb7707b99d1eedfe2f1..838407950b8eb065784e43961682e35b033313a9 100644 (file)
@@ -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;
index f36fb24e0ca7c48451765d3dc59cf3f0274ef3cb..6b12ed2a9a83300650a4bf79e1b6b5d8bffce0c8 100644 (file)
@@ -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,7 +2148,7 @@ 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);
        }
 
@@ -2156,7 +2156,7 @@ set_times_from_entry(struct archive_write_disk *a)
                         atime, atime_nsec,
                         birthtime, birthtime_nsec,
                         mtime, mtime_nsec,
-                        ctime, ctime_nsec);
+                        cctime, ctime_nsec);
 }
 
 static int
index 9fbf98bcf4480e860332c58367a3c4d310039963..6e08e2d155b814c7e127eb048c909e606a14dac5 100644 (file)
@@ -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;
index 069e7324ebc0e4aad75282b652f170f8e899eff3..79902620e34e5200a783f2835ebe054ba1f0a2e3 100644 (file)
@@ -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) {
index dc38c5a68eb00dd3c7b267d596037d7fc8f157dd..7c71935df6e429cbc4d73f5d13cbc82a6791eb61 100644 (file)
@@ -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 {
index f4169e3256d24a874ab479d4473ea4ca84aca91c..648dbf01ee1ac3af9a0e739cd1157de157264e6e 100644 (file)
@@ -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) {
index ce3fa82ef5ba9406fefad28a364b80e8048eeab9..1565af6b37ce7150caef75b461d5ea6a1872586c 100644 (file)
@@ -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);
index 26b5ee3faaa91ff91f7da901392277865dc9db52..e066f559d3bfeb7e0f72393f04099a9267186ba1 100644 (file)
@@ -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 {