Permalink
Browse files

Fix build failure in aggressive warnings on msys.

  • Loading branch information...
1 parent bf6fc3b commit 97d9cd37d076d63d95aa187eb360e633f00ab7d6 @ggcueroad ggcueroad committed Feb 16, 2012
View
2 cpio/cpio_windows.c
@@ -324,7 +324,7 @@ cpio_dosmaperr(unsigned long e)
return;
}
- for (i = 0; i < sizeof(doserrors); i++) {
+ for (i = 0; i < (int)sizeof(doserrors); i++) {
if (doserrors[i].winerr == e) {
errno = doserrors[i].doserr;
return;
View
11 cpio/test/main.c
@@ -129,7 +129,14 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
-void *GetFunctionKernel32(const char *name)
+static void *GetFunctionKernel32(const char *);
+static int my_CreateSymbolicLinkA(const char *, const char *, int);
+static int my_CreateHardLinkA(const char *, const char *);
+static int my_GetFileInformationByName(const char *,
+ BY_HANDLE_FILE_INFORMATION *);
+
+static void *
+GetFunctionKernel32(const char *name)
{
static HINSTANCE lib;
static int set;
@@ -168,7 +175,7 @@ my_CreateHardLinkA(const char *linkname, const char *target)
return f == NULL ? 0 : (*f)(linkname, target, NULL);
}
-int
+static int
my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
{
HANDLE h;
View
6 libarchive/archive_entry_copy_bhfi.c
@@ -34,18 +34,18 @@ __FBSDID("$FreeBSD$");
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
__inline static void
-fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
+fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns)
{
ULARGE_INTEGER utc;
utc.HighPart = filetime->dwHighDateTime;
utc.LowPart = filetime->dwLowDateTime;
if (utc.QuadPart >= EPOC_TIME) {
utc.QuadPart -= EPOC_TIME;
- *time = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
+ *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
*ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */
} else {
- *time = 0;
+ *t = 0;
*ns = 0;
}
}
View
15 libarchive/archive_match.c
@@ -1112,37 +1112,38 @@ set_timefilter_date_w(struct archive_match *a, int timetype,
}
#if defined(_WIN32) && !defined(__CYGWIN__)
-#define EPOC_TIME (116444736000000000ui64)
+#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
static int
set_timefilter_find_data(struct archive_match *a, int timetype,
DWORD ftLastWriteTime_dwHighDateTime, DWORD ftLastWriteTime_dwLowDateTime,
DWORD ftCreationTime_dwHighDateTime, DWORD ftCreationTime_dwLowDateTime)
{
ULARGE_INTEGER utc;
- time_t ctime, mtime;
+ time_t ctime_sec, mtime_sec;
long ctime_ns, mtime_ns;
utc.HighPart = ftCreationTime_dwHighDateTime;
utc.LowPart = ftCreationTime_dwLowDateTime;
if (utc.QuadPart >= EPOC_TIME) {
utc.QuadPart -= EPOC_TIME;
- ctime = (time_t)(utc.QuadPart / 10000000);
+ ctime_sec = (time_t)(utc.QuadPart / 10000000);
ctime_ns = (long)(utc.QuadPart % 10000000) * 100;
} else {
- ctime = 0;
+ ctime_sec = 0;
ctime_ns = 0;
}
utc.HighPart = ftLastWriteTime_dwHighDateTime;
utc.LowPart = ftLastWriteTime_dwLowDateTime;
if (utc.QuadPart >= EPOC_TIME) {
utc.QuadPart -= EPOC_TIME;
- mtime = (time_t)(utc.QuadPart / 10000000);
+ mtime_sec = (time_t)(utc.QuadPart / 10000000);
mtime_ns = (long)(utc.QuadPart % 10000000) * 100;
} else {
- mtime = 0;
+ mtime_sec = 0;
mtime_ns = 0;
}
- 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
6 libarchive/archive_read_disk_windows.c
@@ -1775,7 +1775,7 @@ tree_dir_next_windows(struct tree *t, const wchar_t *pattern)
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
static void
-fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
+fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns)
{
ULARGE_INTEGER utc;
@@ -1784,11 +1784,11 @@ fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
if (utc.QuadPart >= EPOC_TIME) {
utc.QuadPart -= EPOC_TIME;
/* milli seconds base */
- *time = (time_t)(utc.QuadPart / 10000000);
+ *t = (time_t)(utc.QuadPart / 10000000);
/* nano seconds base */
*ns = (long)(utc.QuadPart % 10000000) * 100;
} else {
- *time = 0;
+ *t = 0;
*ns = 0;
}
}
View
8 libarchive/archive_read_support_format_7zip.c
@@ -2980,7 +2980,7 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
size_t bytes_in, bytes_out;
const void *buff_in;
unsigned char *buff_out;
- int eof;
+ int end_of_data;
/*
* Note: '1' here is a performance optimization.
@@ -3008,10 +3008,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
buff_in, &bytes_in);
switch (r) {
case ARCHIVE_OK:
- eof = 0;
+ end_of_data = 0;
break;
case ARCHIVE_EOF:
- eof = 1;
+ end_of_data = 1;
break;
default:
return (ARCHIVE_FATAL);
@@ -3036,7 +3036,7 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
if (zip->pack_stream_inbytes_remaining == 0 &&
zip->folder_outbytes_remaining == 0)
break;
- if (eof || (bytes_in == 0 && bytes_out == 0)) {
+ if (end_of_data || (bytes_in == 0 && bytes_out == 0)) {
archive_set_error(&(a->archive),
ARCHIVE_ERRNO_MISC, "Damaged 7-Zip archive");
return (ARCHIVE_FATAL);
View
2 libarchive/archive_string.c
@@ -517,7 +517,7 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest,
if (NULL == archive_wstring_ensure(dest,
dest->length + count + 1))
return (-1);
- wmemcpy(dest->s + dest->length, (wchar_t *)s, count);
+ wmemcpy(dest->s + dest->length, (const wchar_t *)s, count);
if ((sc->flag & SCONV_FROM_UTF16BE) && !is_big_endian()) {
uint16_t *u16 = (uint16_t *)(dest->s + dest->length);
int b;
View
2 libarchive/archive_windows.c
@@ -796,7 +796,7 @@ __la_dosmaperr(unsigned long e)
return;
}
- for (i = 0; i < sizeof(doserrors); i++)
+ for (i = 0; i < (int)sizeof(doserrors); i++)
{
if (doserrors[i].winerr == e)
{
View
26 libarchive/archive_write_disk_windows.c
@@ -82,7 +82,7 @@ static BOOL SetFilePointerEx_perso(HANDLE hFile,
if(lpNewFilePointer) {
lpNewFilePointer->QuadPart = li.QuadPart;
}
- return li.LowPart != -1 || GetLastError() == NO_ERROR;
+ return li.LowPart != (DWORD)-1 || GetLastError() == NO_ERROR;
}
struct fixup_entry {
@@ -212,7 +212,9 @@ static struct fixup_entry *current_fixup(struct archive_write_disk *,
static int cleanup_pathname(struct archive_write_disk *);
static int create_dir(struct archive_write_disk *, wchar_t *);
static int create_parent_dir(struct archive_write_disk *, wchar_t *);
+static int la_chmod(const wchar_t *, mode_t);
static int older(BY_HANDLE_FILE_INFORMATION *, struct archive_entry *);
+static int permissive_name_w(struct archive_write_disk *);
static int restore_entry(struct archive_write_disk *);
static int set_acls(struct archive_write_disk *, HANDLE h,
const wchar_t *, struct archive_acl *);
@@ -353,7 +355,7 @@ file_information(struct archive_write_disk *a, wchar_t *path,
* So we have to make the full-pathname in another way, which does not
* break "../" path string.
*/
-int
+static int
permissive_name_w(struct archive_write_disk *a)
{
wchar_t *wn, *wnp;
@@ -479,7 +481,7 @@ permissive_name_w(struct archive_write_disk *a)
return (0);
}
-int
+static int
la_chmod(const wchar_t *path, mode_t mode)
{
DWORD attr;
@@ -2237,7 +2239,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 ctime_sec, long ctime_nanos)
{
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
#define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME)\
@@ -2248,7 +2250,7 @@ set_times(struct archive_write_disk *a,
FILETIME *pfbtime;
FILETIME fatime, fbtime, fmtime;
- (void)ctime; /* UNUSED */
+ (void)ctime_sec; /* UNUSED */
(void)ctime_nanos; /* UNUSED */
if (h != INVALID_HANDLE_VALUE) {
@@ -2299,11 +2301,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, ctime_sec;
long atime_nsec, birthtime_nsec, mtime_nsec, ctime_nsec;
/* Suitable defaults. */
- atime = birthtime = mtime = ctime = a->start_time;
+ atime = birthtime = mtime = ctime_sec = a->start_time;
atime_nsec = birthtime_nsec = mtime_nsec = ctime_nsec = 0;
/* If no time was provided, we're done. */
@@ -2325,15 +2327,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);
+ ctime_sec = archive_entry_ctime(a->entry);
ctime_nsec = archive_entry_ctime_nsec(a->entry);
}
return set_times(a, a->fh, a->mode, a->name,
atime, atime_nsec,
birthtime, birthtime_nsec,
mtime, mtime_nsec,
- ctime, ctime_nsec);
+ ctime_sec, ctime_nsec);
}
static int
@@ -2456,7 +2458,7 @@ set_xattrs(struct archive_write_disk *a)
}
static void
-fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
+fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns)
{
ULARGE_INTEGER utc;
@@ -2465,11 +2467,11 @@ fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
if (utc.QuadPart >= EPOC_TIME) {
utc.QuadPart -= EPOC_TIME;
/* milli seconds base */
- *time = (time_t)(utc.QuadPart / 10000000);
+ *t = (time_t)(utc.QuadPart / 10000000);
/* nano seconds base */
*ns = (long)(utc.QuadPart % 10000000) * 100;
} else {
- *time = 0;
+ *t = 0;
*ns = 0;
}
}
View
34 libarchive/archive_write_set_format_7zip.c
@@ -1151,7 +1151,7 @@ make_time(struct archive_write *a, uint8_t type, unsigned flg, int ti)
struct _7zip *zip = (struct _7zip *)a->format_data;
struct file *file;
int r;
- uint8_t mask, byte;
+ uint8_t b, mask;
/*
* Make Time Bools.
@@ -1188,23 +1188,23 @@ make_time(struct archive_write *a, uint8_t type, unsigned flg, int ti)
if (r < 0)
return (r);
- byte = 0;
+ b = 0;
mask = 0x80;
file = zip->file_list.first;
for (;file != NULL; file = file->next) {
if (file->flg & flg)
- byte |= mask;
+ b |= mask;
mask >>= 1;
if (mask == 0) {
- r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+ r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
if (r < 0)
return (r);
mask = 0x80;
- byte = 0;
+ b = 0;
}
}
if (mask != 0x80) {
- r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+ r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
if (r < 0)
return (r);
}
@@ -1240,7 +1240,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
struct _7zip *zip = (struct _7zip *)a->format_data;
struct file *file;
int r;
- uint8_t mask, byte;
+ uint8_t b, mask;
/*
* Make FilesInfo.
@@ -1288,23 +1288,23 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
if (r < 0)
return (r);
- byte = 0;
+ b = 0;
mask = 0x80;
file = zip->file_list.first;
for (;file != NULL; file = file->next) {
if (file->size == 0)
- byte |= mask;
+ b |= mask;
mask >>= 1;
if (mask == 0) {
- r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+ r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
if (r < 0)
return (r);
mask = 0x80;
- byte = 0;
+ b = 0;
}
}
if (mask != 0x80) {
- r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+ r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
if (r < 0)
return (r);
}
@@ -1321,25 +1321,25 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
if (r < 0)
return (r);
- byte = 0;
+ b = 0;
mask = 0x80;
file = zip->file_list.first;
for (;file != NULL; file = file->next) {
if (file->size)
continue;
if (!file->dir)
- byte |= mask;
+ b |= mask;
mask >>= 1;
if (mask == 0) {
- r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+ r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
if (r < 0)
return (r);
mask = 0x80;
- byte = 0;
+ b = 0;
}
}
if (mask != 0x80) {
- r = compress_out(a, &byte, 1, ARCHIVE_Z_RUN);
+ r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
if (r < 0)
return (r);
}
View
6 libarchive/archive_write_set_format_mtree.c
@@ -389,13 +389,13 @@ dir_len(struct mtree_entry *me)
else if (*p == '/')
al = p - path;
}
- if (l == -1)
+ if (l == (size_t)-1)
goto alen;
size = p - path;
rp = p = path;
while (*p != '\0') {
l = mbtowc(&wc, p, size);
- if (l == -1)
+ if (l == (size_t)-1)
goto alen;
if (l == 1 && (wc == L'/' || wc == L'\\'))
rp = p;
@@ -404,7 +404,7 @@ dir_len(struct mtree_entry *me)
}
return (rp - path + 1);
alen:
- if (al == -1)
+ if (al == (size_t)-1)
return (0);
return (al + 1);
}
View
11 libarchive/test/main.c
@@ -127,7 +127,14 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
-void *GetFunctionKernel32(const char *name)
+static void *GetFunctionKernel32(const char *);
+static int my_CreateSymbolicLinkA(const char *, const char *, int);
+static int my_CreateHardLinkA(const char *, const char *);
+static int my_GetFileInformationByName(const char *,
+ BY_HANDLE_FILE_INFORMATION *);
+
+static void *
+GetFunctionKernel32(const char *name)
{
static HINSTANCE lib;
static int set;
@@ -166,7 +173,7 @@ my_CreateHardLinkA(const char *linkname, const char *target)
return f == NULL ? 0 : (*f)(linkname, target, NULL);
}
-int
+static int
my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
{
HANDLE h;
View
2 tar/bsdtar_windows.c
@@ -283,7 +283,7 @@ __tar_dosmaperr(unsigned long e)
return;
}
- for (i = 0; i < sizeof(doserrors); i++) {
+ for (i = 0; i < (int)sizeof(doserrors); i++) {
if (doserrors[i].winerr == e) {
errno = doserrors[i].doserr;
return;
View
11 tar/test/main.c
@@ -129,7 +129,14 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientz
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
-void *GetFunctionKernel32(const char *name)
+static void *GetFunctionKernel32(const char *);
+static int my_CreateSymbolicLinkA(const char *, const char *, int);
+static int my_CreateHardLinkA(const char *, const char *);
+static int my_GetFileInformationByName(const char *,
+ BY_HANDLE_FILE_INFORMATION *);
+
+static void *
+GetFunctionKernel32(const char *name)
{
static HINSTANCE lib;
static int set;
@@ -168,7 +175,7 @@ my_CreateHardLinkA(const char *linkname, const char *target)
return f == NULL ? 0 : (*f)(linkname, target, NULL);
}
-int
+static int
my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
{
HANDLE h;

0 comments on commit 97d9cd3

Please sign in to comment.