win32: fix platform checks

This commit is contained in:
Kacper Michajłow 2024-05-01 21:39:19 +02:00
parent 5c2918b4f3
commit 86abbb89a7
5 changed files with 14 additions and 14 deletions

View File

@ -19,7 +19,7 @@
#include <string.h>
#include <sys/types.h>
#ifdef __MINGW32__
#ifdef _WIN32
#include <windows.h>
#else
#include <poll.h>
@ -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);

View File

@ -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 <io.h>
#include <fcntl.h>

View File

@ -95,14 +95,14 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s);
#endif
#ifdef __CYGWIN__
#if defined(_WIN32) && !defined(__MINGW32__)
#include <io.h>
#include "dirent-win.h"
#else
#include <dirent.h>
#endif
#ifdef __MINGW32__
#ifdef _WIN32
#include <stdio.h>
#include <sys/stat.h>

View File

@ -292,7 +292,7 @@ bool mp_load_scripts(struct MPContext *mpctx)
#if HAVE_CPLUGINS
#if !HAVE_WIN32
#ifndef _WIN32
#include <dlfcn.h>
#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",

View File

@ -25,7 +25,7 @@
#include <fcntl.h>
#include <errno.h>
#ifndef __MINGW32__
#ifndef _WIN32
#include <poll.h>
#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