summaryrefslogtreecommitdiffstats
path: root/osdep/io.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:13:14 +0000
commit60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch)
tree1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /osdep/io.h
parentAdding upstream version 0.37.0. (diff)
downloadmpv-upstream.tar.xz
mpv-upstream.zip
Adding upstream version 0.38.0.upstream/0.38.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'osdep/io.h')
-rw-r--r--osdep/io.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/osdep/io.h b/osdep/io.h
index db711fb..3944eb9 100644
--- a/osdep/io.h
+++ b/osdep/io.h
@@ -29,6 +29,8 @@
#include <fcntl.h>
#include <locale.h>
+#include "compiler.h"
+
#if HAVE_GLOB_POSIX
#include <glob.h>
#endif
@@ -78,9 +80,19 @@ int mp_make_wakeup_pipe(int pipes[2]);
void mp_flush_wakeup_pipe(int pipe_end);
#ifdef _WIN32
+
#include <wchar.h>
wchar_t *mp_from_utf8(void *talloc_ctx, const char *s);
char *mp_to_utf8(void *talloc_ctx, const wchar_t *s);
+
+// Use this in win32-specific code rather than PATH_MAX or MAX_PATH.
+// This is necessary because we declare long-path aware support which raises
+// the effective limit without affecting any defines.
+// The actual limit is 32767 but there's a few edge cases that reduce
+// it. So pick this nice round number.
+// Note that this is wchars, not chars.
+#define MP_PATH_MAX (32000)
+
#endif
#ifdef __CYGWIN__
@@ -94,8 +106,10 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s);
#include <sys/stat.h>
#include <fcntl.h>
-int mp_printf(const char *format, ...);
-int mp_fprintf(FILE *stream, const char *format, ...);
+size_t mp_fwrite(const void *restrict buffer, size_t size, size_t count,
+ FILE *restrict stream);
+int mp_printf(const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
+int mp_fprintf(FILE *stream, const char *format, ...) PRINTF_ATTRIBUTE(2, 3);
int mp_open(const char *filename, int oflag, ...);
int mp_creat(const char *filename, int mode);
int mp_rename(const char *oldpath, const char *newpath);
@@ -104,6 +118,7 @@ DIR *mp_opendir(const char *path);
struct dirent *mp_readdir(DIR *dir);
int mp_closedir(DIR *dir);
int mp_mkdir(const char *path, int mode);
+int mp_unlink(const char *path);
char *mp_win32_getcwd(char *buf, size_t size);
char *mp_getenv(const char *name);
@@ -161,6 +176,7 @@ int mp_glob(const char *restrict pattern, int flags,
int (*errfunc)(const char*, int), mp_glob_t *restrict pglob);
void mp_globfree(mp_glob_t *pglob);
+#define fwrite(...) mp_fwrite(__VA_ARGS__)
#define printf(...) mp_printf(__VA_ARGS__)
#define fprintf(...) mp_fprintf(__VA_ARGS__)
#define open(...) mp_open(__VA_ARGS__)
@@ -171,6 +187,7 @@ void mp_globfree(mp_glob_t *pglob);
#define readdir(...) mp_readdir(__VA_ARGS__)
#define closedir(...) mp_closedir(__VA_ARGS__)
#define mkdir(...) mp_mkdir(__VA_ARGS__)
+#define unlink(...) mp_unlink(__VA_ARGS__)
#define getcwd(...) mp_win32_getcwd(__VA_ARGS__)
#define getenv(...) mp_getenv(__VA_ARGS__)
@@ -227,6 +244,4 @@ extern char **environ;
#endif /* __MINGW32__ */
-int mp_mkostemps(char *template, int suffixlen, int flags);
-
#endif