From 86abbb89a79b63e0dc64382bd7c478542a0d3682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Wed, 1 May 2024 21:39:19 +0200 Subject: [PATCH] win32: fix platform checks --- misc/thread_tools.c | 4 ++-- osdep/io.c | 8 ++++---- osdep/io.h | 4 ++-- player/scripting.c | 4 ++-- stream/stream_file.c | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/misc/thread_tools.c b/misc/thread_tools.c index 43426a7546..7a9303c727 100644 --- a/misc/thread_tools.c +++ b/misc/thread_tools.c @@ -19,7 +19,7 @@ #include #include -#ifdef __MINGW32__ +#ifdef _WIN32 #include #else #include @@ -260,7 +260,7 @@ int mp_cancel_get_fd(struct mp_cancel *c) return c->wakeup_pipe[0]; } -#ifdef __MINGW32__ +#ifdef _WIN32 void *mp_cancel_get_event(struct mp_cancel *c) { mp_mutex_lock(&c->lock); diff --git a/osdep/io.c b/osdep/io.c index 0ee0c3dcfe..a58eb6ec04 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -62,7 +62,7 @@ bool mp_set_cloexec(int fd) return true; } -#ifdef __MINGW32__ +#ifdef _WIN32 int mp_make_cloexec_pipe(int pipes[2]) { pipes[0] = pipes[1] = -1; @@ -82,7 +82,7 @@ int mp_make_cloexec_pipe(int pipes[2]) } #endif -#ifdef __MINGW32__ +#ifdef _WIN32 int mp_make_wakeup_pipe(int pipes[2]) { return mp_make_cloexec_pipe(pipes); @@ -104,7 +104,7 @@ int mp_make_wakeup_pipe(int pipes[2]) void mp_flush_wakeup_pipe(int pipe_end) { -#ifndef __MINGW32__ +#ifndef _WIN32 char buf[100]; (void)read(pipe_end, buf, sizeof(buf)); #endif @@ -142,7 +142,7 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s) #endif // _WIN32 -#ifdef __MINGW32__ +#ifdef _WIN32 #include #include diff --git a/osdep/io.h b/osdep/io.h index 6d2903c30a..b8a7c93c1e 100644 --- a/osdep/io.h +++ b/osdep/io.h @@ -95,14 +95,14 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s); #endif -#ifdef __CYGWIN__ +#if defined(_WIN32) && !defined(__MINGW32__) #include #include "dirent-win.h" #else #include #endif -#ifdef __MINGW32__ +#ifdef _WIN32 #include #include diff --git a/player/scripting.c b/player/scripting.c index 0647c0e007..5c99f4c70e 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -292,7 +292,7 @@ bool mp_load_scripts(struct MPContext *mpctx) #if HAVE_CPLUGINS -#if !HAVE_WIN32 +#ifndef _WIN32 #include #endif @@ -392,7 +392,7 @@ error: ; const struct mp_scripting mp_scripting_cplugin = { .name = "cplugin", - #if HAVE_WIN32 + #ifdef _WIN32 .file_ext = "dll", #else .file_ext = "so", diff --git a/stream/stream_file.c b/stream/stream_file.c index ff78e7d370..ff42e72eea 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -25,7 +25,7 @@ #include #include -#ifndef __MINGW32__ +#ifndef _WIN32 #include #endif @@ -89,7 +89,7 @@ static int fill_buffer(stream_t *s, void *buffer, int max_len) { struct priv *p = s->priv; -#ifndef __MINGW32__ +#ifndef _WIN32 if (p->use_poll) { int c = mp_cancel_get_fd(p->cancel); struct pollfd fds[2] = { @@ -314,7 +314,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args) MP_INFO(stream, "This is a directory - adding to playlist.\n"); } else if (S_ISREG(st.st_mode)) { p->regular_file = true; -#ifndef __MINGW32__ +#ifndef _WIN32 // O_NONBLOCK has weird semantics on file locks; remove it. int val = fcntl(p->fd, F_GETFL) & ~(unsigned)O_NONBLOCK; fcntl(p->fd, F_SETFL, val); @@ -327,7 +327,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args) } } -#ifdef __MINGW32__ +#ifdef _WIN32 setmode(p->fd, O_BINARY); #endif