]> 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>
Thu, 9 Feb 2012 00:36:41 +0000 (09:36 +0900)
12 files changed:
cpio/test/main.c
libarchive/archive_acl.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 d9e6c302bbb77594e584e13cce384cc96c6eb0d1..e19aabcc42c63cfc0764a886ecb3885dc7c55255 100644 (file)
@@ -2505,25 +2505,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 4747a4c5a11f314504db51eba1e5d5450aa308b8..101df9b644e3e594f05a0514b1c520bf7c0aef3f 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);
@@ -1088,7 +1088,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) {
@@ -1096,7 +1096,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) {
@@ -1104,7 +1104,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)) {
@@ -1117,7 +1117,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)) {
@@ -1246,7 +1246,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 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 2ed9abc00c8baf280c5ab582c621a0727a89a1aa..bc58013a45887c229d947525504b8a9993132a3c 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
@@ -2517,17 +2516,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;
        }
 }
@@ -3506,16 +3505,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);
@@ -3556,7 +3555,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; }
 
@@ -3622,14 +3621,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 be922874902ec02a9bfc6e0cc09144baaba33dea..a07960f550fbfcd1bd517730420138cbdf809db3 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 dbfa3e93f8c4488c289aa0eda7103e9fb720ba87..8b07aaa0d6d8de17ee6d1d2e70d8b56dfcd9f331 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 8e1c01830e4b05ada0fd5fedbacce0773f3eaa4d..2e43be54343fe6546ea1362c128a9514dcca3e81 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 3d7ead581ff3e2ed063f42ac08e852ec7c75eb13..64f0380602d5b8f35259b6d41a2ea86f3b537376 100644 (file)
@@ -2503,25 +2503,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 b85940bf4b32ff84d6b041f9c8990c6379ad27e2..eb33cf27145a5e8500a9ea3958d4285a255b296b 100644 (file)
@@ -2505,25 +2505,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 {