From 70a4a723c507efc4e1bcfa4d4685da0821bff6dc Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 15 Jul 2015 11:45:53 +0100 Subject: win32: silence some compiler warnings --- include/mingw.h | 5 +++++ libbb/lineedit.c | 6 +++--- win32/mingw.c | 3 ++- win32/mntent.c | 14 ++++++++------ win32/process.c | 2 +- win32/uname.c | 6 +++--- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/mingw.h b/include/mingw.h index fa760342b..858e011de 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -214,6 +214,11 @@ void unsetenv(const char *env); */ void *mempcpy(void *dest, const void *src, size_t n); +/* + * strings.h + */ +int ffs(int i); + /* * sys/ioctl.h */ diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 86ded6bc5..5cb40a508 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -760,7 +760,7 @@ static int path_parse(char ***p) npth = 1; /* path component count */ while (1) { #if ENABLE_PLATFORM_MINGW32 - tmp = next_path_sep(tmp); + tmp = (char *)next_path_sep(tmp); #else tmp = strchr(tmp, ':'); #endif @@ -777,7 +777,7 @@ static int path_parse(char ***p) npth = 1; while (1) { #if ENABLE_PLATFORM_MINGW32 - tmp = next_path_sep(tmp); + tmp = (char *)next_path_sep(tmp); #else tmp = strchr(tmp, ':'); #endif @@ -2329,7 +2329,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman INIT_S(); #if ENABLE_PLATFORM_MINGW32 - memset(initial_settings.c_cc, sizeof(initial_settings.c_cc), 0); + memset(initial_settings.c_cc, 0, sizeof(initial_settings.c_cc)); initial_settings.c_cc[VINTR] = CTRL('C'); initial_settings.c_cc[VEOF] = CTRL('D'); if (!isatty(0) || !isatty(1)) { diff --git a/win32/mingw.c b/win32/mingw.c index 824413586..6b63e2487 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -648,7 +648,8 @@ struct group *getgrgid(gid_t gid UNUSED_PARAM) return &g; } -int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups) +int getgrouplist(const char *user UNUSED_PARAM, gid_t group UNUSED_PARAM, + gid_t *groups, int *ngroups) { if ( *ngroups == 0 ) { *ngroups = 1; diff --git a/win32/mntent.c b/win32/mntent.c index d39ceb4a6..9b04a9c5e 100644 --- a/win32/mntent.c +++ b/win32/mntent.c @@ -28,10 +28,11 @@ struct mntent *getmntent(FILE *stream) struct mntdata *data = (struct mntdata *)stream; static char mnt_fsname[4]; static char mnt_dir[4]; + static char mnt_type[100]; + static char mnt_opts[4]; static struct mntent my_mount_entry = - { mnt_fsname, mnt_dir, (char *)"", (char *)"", 0, 0 }; + { mnt_fsname, mnt_dir, mnt_type, mnt_opts, 0, 0 }; struct mntent *entry; - static char fsname[100]; entry = NULL; while ( ++data->index < 26 ) { @@ -43,12 +44,13 @@ struct mntent *getmntent(FILE *stream) mnt_dir[1] = ':'; mnt_dir[2] = '\\'; mnt_dir[3] = '\0'; + mnt_type[0] = '\0'; + mnt_opts[0] = '\0'; if ( GetDriveType(mnt_dir) == DRIVE_FIXED ) { - my_mount_entry.mnt_type = ""; - if ( GetVolumeInformation(mnt_dir, NULL, 0, NULL, NULL, - NULL, fsname, 100) ) { - my_mount_entry.mnt_type = fsname; + if ( !GetVolumeInformation(mnt_dir, NULL, 0, NULL, NULL, + NULL, mnt_type, 100) ) { + mnt_type[0] = '\0'; } entry = &my_mount_entry; diff --git a/win32/process.c b/win32/process.c index e38792b5a..2206a0a5e 100644 --- a/win32/process.c +++ b/win32/process.c @@ -10,7 +10,7 @@ int waitpid(pid_t pid, int *status, int options) if (pid > 0 && options == 0) { if ( (proc=OpenProcess(SYNCHRONIZE|PROCESS_QUERY_INFORMATION, FALSE, pid)) != NULL ) { - ret = _cwait(status, proc, 0); + ret = _cwait(status, (intptr_t)proc, 0); CloseHandle(proc); return ret; } diff --git a/win32/uname.c b/win32/uname.c index 465ba1e28..3b3e21f8d 100644 --- a/win32/uname.c +++ b/win32/uname.c @@ -20,9 +20,9 @@ int uname(struct utsname *name) strcpy(name->release, unk); strcpy(name->version, unk); if (GetVersionEx(&os_info)) { - sprintf(name->release, "%d.%d", os_info.dwMajorVersion, - os_info.dwMinorVersion); - sprintf(name->version, "%d", os_info.dwBuildNumber); + sprintf(name->release, "%u.%u", (unsigned int)os_info.dwMajorVersion, + (unsigned int)os_info.dwMinorVersion); + sprintf(name->version, "%u", (unsigned int)os_info.dwBuildNumber); } strcpy(name->machine, unk); -- cgit v1.2.3-55-g6feb