From cd12e923f8f44e6bfbd25cdbf13b2638f2fc69a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 3 May 2024 02:30:15 +0200 Subject: [PATCH] test/libmpv_encode: minor adjustments for win32 build fix --- test/libmpv_encode.c | 12 ++++++++++-- test/meson.build | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/libmpv_encode.c b/test/libmpv_encode.c index 49ca166310..183cd768f7 100644 --- a/test/libmpv_encode.c +++ b/test/libmpv_encode.c @@ -20,9 +20,15 @@ #include #include #include -#include #include +#ifdef _WIN32 +#include +#include +#else +#include +#endif + // Stolen from osdep/compiler.h #ifdef __GNUC__ #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format(printf, a1, a2))) @@ -97,6 +103,8 @@ static void check_output(int fd) puts("output file ok"); } +int mp_mkostemps(char *template, int suffixlen, int flags); + int main(int argc, char *argv[]) { atexit(exit_cleanup); @@ -108,7 +116,7 @@ int main(int argc, char *argv[]) int fd; { char path[] = "./testout.XXXXXX"; - fd = mkstemp(path); + fd = mp_mkostemps(path, 0, 0); if (fd == -1) fail("mkstemp failed"); out_path = strdup(path); diff --git a/test/meson.build b/test/meson.build index f77ddf3092..e4c8d0f5b6 100644 --- a/test/meson.build +++ b/test/meson.build @@ -15,6 +15,7 @@ test_utils_files = [ 'common/common.c', 'misc/bstr.c', 'misc/dispatch.c', + 'misc/io_utils.c', 'misc/json.c', 'misc/node.c', 'misc/path_utils.c', @@ -124,7 +125,7 @@ if get_option('libmpv') test('libmpv', exe, args: file, timeout: 60) exe = executable('libmpv-encode', 'libmpv_encode.c', - include_directories: incdir, link_with: libmpv) + include_directories: incdir, link_with: [libmpv, test_utils]) test('libmpv-encode', exe, timeout: 30) endif