Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win: fix some MinGW warnings #2854

Merged
merged 5 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/win/fs-fd-hash-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ static struct uv__fd_hash_bucket_s uv__fd_hash[UV__FD_HASH_SIZE];


INLINE static void uv__fd_hash_init(void) {
int i, err;
size_t i;
int err;

err = uv_mutex_init(&uv__fd_hash_mutex);
if (err) {
Expand Down
11 changes: 5 additions & 6 deletions src/win/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ void fs__close(uv_fs_t* req) {

LONG fs__filemap_ex_filter(LONG excode, PEXCEPTION_POINTERS pep,
int* perror) {
if (excode != EXCEPTION_IN_PAGE_ERROR) {
if (excode != (LONG)EXCEPTION_IN_PAGE_ERROR) {
return EXCEPTION_CONTINUE_SEARCH;
}

Expand Down Expand Up @@ -816,10 +816,10 @@ void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) {
for (index = 0;
index < req->fs.info.nbufs && done_read < read_size;
++index) {
int err = 0;
size_t this_read_size = MIN(req->fs.info.bufs[index].len,
read_size - done_read);
#ifdef _MSC_VER
int err = 0;
__try {
#endif
memcpy(req->fs.info.bufs[index].base,
Expand Down Expand Up @@ -938,7 +938,7 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,
(UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR);
size_t write_size, done_write;
unsigned int index;
LARGE_INTEGER zero, pos, end_pos;
LARGE_INTEGER pos, end_pos;
size_t view_offset;
LARGE_INTEGER view_base;
void* view;
Expand All @@ -963,7 +963,6 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,
return;
}

zero.QuadPart = 0;
if (force_append) {
pos = fd_info->size;
} else if (req->fs.info.offset == -1) {
Expand Down Expand Up @@ -1014,8 +1013,8 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,

done_write = 0;
for (index = 0; index < req->fs.info.nbufs; ++index) {
int err = 0;
#ifdef _MSC_VER
int err = 0;
__try {
#endif
memcpy((char*)view + view_offset + done_write,
Expand Down Expand Up @@ -1407,7 +1406,7 @@ void fs__scandir(uv_fs_t* req) {
/* If the handle is not a directory, we'll get STATUS_INVALID_PARAMETER.
* This should be reported back as UV_ENOTDIR.
*/
if (status == STATUS_INVALID_PARAMETER)
if (status == (NTSTATUS)STATUS_INVALID_PARAMETER)
goto not_a_directory_error;

while (NT_SUCCESS(status)) {
Expand Down
1 change: 1 addition & 0 deletions src/win/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,7 @@ static DWORD WINAPI uv__tty_console_resize_watcher_thread(void* param) {
uv__tty_console_signal_resize();
ResetEvent(uv__tty_console_resized);
}
return 0;
}

static void uv__tty_console_signal_resize(void) {
Expand Down
8 changes: 6 additions & 2 deletions src/win/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
#include "uv.h"
#include "internal.h"

/* clang-format off */
#include <winsock2.h>
#include <winperf.h>
#include <iphlpapi.h>
#include <psapi.h>
#include <tlhelp32.h>
#include <windows.h>
/* clang-format on */
#include <userenv.h>
#include <math.h>

Expand Down Expand Up @@ -1806,7 +1808,9 @@ int uv_os_uname(uv_utsname_t* buffer) {
pRtlGetVersion(&os_info);
} else {
/* Silence GetVersionEx() deprecation warning. */
#ifdef _MSC_VER
#pragma warning(suppress : 4996)
#endif
if (GetVersionExW(&os_info) == 0) {
r = uv_translate_sys_error(GetLastError());
goto error;
Expand Down Expand Up @@ -1873,7 +1877,7 @@ int uv_os_uname(uv_utsname_t* buffer) {
"MINGW32_NT-%u.%u",
(unsigned int) os_info.dwMajorVersion,
(unsigned int) os_info.dwMinorVersion);
assert(r < sizeof(buffer->sysname));
assert((size_t)r < sizeof(buffer->sysname));
#else
uv__strscpy(buffer->sysname, "Windows_NT", sizeof(buffer->sysname));
#endif
Expand All @@ -1885,7 +1889,7 @@ int uv_os_uname(uv_utsname_t* buffer) {
(unsigned int) os_info.dwMajorVersion,
(unsigned int) os_info.dwMinorVersion,
(unsigned int) os_info.dwBuildNumber);
assert(r < sizeof(buffer->release));
assert((size_t)r < sizeof(buffer->release));

/* Populate the machine field. */
GetSystemInfo(&system_info);
Expand Down