From e8c9f63c8e618d85104369a4c588129b165851e2 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 13 Mar 2014 22:02:12 +0000 Subject: Fix some compiler warnings --- include/mingw.h | 2 +- win32/mempcpy.c | 1 + win32/mingw.c | 18 +++++++++--------- win32/mntent.c | 5 +++-- win32/process.c | 2 +- win32/termios.c | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/mingw.h b/include/mingw.h index 219712780..198ea911e 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -305,7 +305,7 @@ int waitpid(pid_t pid, int *status, unsigned options); struct tm *gmtime_r(const time_t *timep, struct tm *result); struct tm *localtime_r(const time_t *timep, struct tm *result); char *strptime(const char *s, const char *format, struct tm *tm); -size_t mingw_strftime(const char *buf, size_t max, const char *format, const struct tm *tm); +size_t mingw_strftime(char *buf, size_t max, const char *format, const struct tm *tm); int stime(time_t *t); #define strftime mingw_strftime diff --git a/win32/mempcpy.c b/win32/mempcpy.c index 81fc88f61..732a6f4b2 100644 --- a/win32/mempcpy.c +++ b/win32/mempcpy.c @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ +#include "libbb.h" /* Specification. */ #include diff --git a/win32/mingw.c b/win32/mingw.c index c52df4bb4..2645aadca 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -366,17 +366,17 @@ static inline void timeval_to_filetime(const struct timeval tv, FILETIME *ft) ft->dwHighDateTime = winTime >> 32; } -int utimes(const char *file_name, const struct timeval times[2]) +int utimes(const char *file_name, const struct timeval tims[2]) { FILETIME mft, aft; HANDLE fh; - DWORD flags; + DWORD flags, attrs; int rc; flags = FILE_ATTRIBUTE_NORMAL; /* must have write permission */ - DWORD attrs = GetFileAttributes(file_name); + attrs = GetFileAttributes(file_name); if ( attrs != INVALID_FILE_ATTRIBUTES ) { if ( attrs & FILE_ATTRIBUTE_READONLY ) { /* ignore errors here; open() will report them */ @@ -397,9 +397,9 @@ int utimes(const char *file_name, const struct timeval times[2]) goto revert_attrs; } - if (times) { - timeval_to_filetime(times[0], &aft); - timeval_to_filetime(times[1], &mft); + if (tims) { + timeval_to_filetime(tims[0], &aft); + timeval_to_filetime(tims[1], &mft); } else { GetSystemTimeAsFileTime(&mft); @@ -566,7 +566,7 @@ struct passwd *getpwuid(int uid UNUSED_PARAM) if (!GetUserName(user_name, &len)) return NULL; p.pw_name = user_name; - p.pw_gecos = "unknown"; + p.pw_gecos = (char *)"unknown"; p.pw_dir = gethomedir(); p.pw_shell = NULL; p.pw_uid = 1000; @@ -811,7 +811,7 @@ int mingw_unlink(const char *pathname) } #undef strftime -size_t mingw_strftime(const char *buf, size_t max, const char *format, const struct tm *tm) +size_t mingw_strftime(char *buf, size_t max, const char *format, const struct tm *tm) { size_t ret; char day[3]; @@ -846,7 +846,7 @@ size_t mingw_strftime(const char *buf, size_t max, const char *format, const str return ret; } -int stime(time_t *t) +int stime(time_t *t UNUSED_PARAM) { errno = EPERM; return -1; diff --git a/win32/mntent.c b/win32/mntent.c index 22efbf1b7..53f098796 100644 --- a/win32/mntent.c +++ b/win32/mntent.c @@ -9,7 +9,7 @@ struct mntdata { int index; }; -FILE *setmntent(const char *file, const char *mode) +FILE *setmntent(const char *file UNUSED_PARAM, const char *mode UNUSED_PARAM) { struct mntdata *data; @@ -28,7 +28,8 @@ struct mntent *getmntent(FILE *stream) struct mntdata *data = (struct mntdata *)stream; static char mnt_fsname[4]; static char mnt_dir[4]; - static struct mntent my_mount_entry = { mnt_fsname, mnt_dir, "", 0, 0 }; + static struct mntent my_mount_entry = + { mnt_fsname, mnt_dir, (char *)"", (char *)"", 0, 0 }; static struct mntent *entry; entry = NULL; diff --git a/win32/process.c b/win32/process.c index 59bc5b4a0..ba6444fac 100644 --- a/win32/process.c +++ b/win32/process.c @@ -332,7 +332,7 @@ mingw_execv(const char *cmd, const char *const *argv) } /* POSIX version in libbb/procps.c */ -procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) +procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags UNUSED_PARAM) { PROCESSENTRY32 pe; diff --git a/win32/termios.c b/win32/termios.c index 12db40133..ad6ab117f 100644 --- a/win32/termios.c +++ b/win32/termios.c @@ -10,7 +10,7 @@ int tcgetattr(int fd UNUSED_PARAM, struct termios *t UNUSED_PARAM) return -1; } -int64_t FAST_FUNC read_key(int fd, char *buf, int timeout) +int64_t FAST_FUNC read_key(int fd, char *buf UNUSED_PARAM, int timeout) { HANDLE cin = GetStdHandle(STD_INPUT_HANDLE); INPUT_RECORD record; -- cgit v1.2.3-55-g6feb