summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
Diffstat (limited to 'osdep')
-rw-r--r--osdep/endian.h4
-rw-r--r--osdep/io.c6
-rw-r--r--osdep/path-win.c9
-rw-r--r--osdep/terminal-unix.c2
-rw-r--r--osdep/terminal-win.c7
-rw-r--r--osdep/terminal.h2
-rw-r--r--osdep/w32_keyboard.c2
7 files changed, 26 insertions, 6 deletions
diff --git a/osdep/endian.h b/osdep/endian.h
index c6d13760ea..733cecca74 100644
--- a/osdep/endian.h
+++ b/osdep/endian.h
@@ -9,6 +9,10 @@
#define BYTE_ORDER __BYTE_ORDER
#define LITTLE_ENDIAN __LITTLE_ENDIAN
#define BIG_ENDIAN __BIG_ENDIAN
+#elif defined(__BYTE_ORDER__)
+#define BYTE_ORDER __BYTE_ORDER__
+#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
+#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
#elif defined(__DARWIN_BYTE_ORDER)
#define BYTE_ORDER __DARWIN_BYTE_ORDER
#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
diff --git a/osdep/io.c b/osdep/io.c
index a58eb6ec04..1e8171de59 100644
--- a/osdep/io.c
+++ b/osdep/io.c
@@ -664,11 +664,12 @@ static void free_env(void)
static void init_getenv(void)
{
#if !HAVE_UWP
- wchar_t *wenv = GetEnvironmentStringsW();
- if (!wenv)
+ wchar_t *wenv_begin = GetEnvironmentStringsW();
+ if (!wenv_begin)
return;
utf8_environ_ctx = talloc_new(NULL);
int num_env = 0;
+ wchar_t *wenv = wenv_begin;
while (1) {
size_t len = wcslen(wenv);
if (!len)
@@ -677,6 +678,7 @@ static void init_getenv(void)
MP_TARRAY_APPEND(utf8_environ_ctx, utf8_environ, num_env, s);
wenv += len + 1;
}
+ FreeEnvironmentStringsW(wenv_begin);
MP_TARRAY_APPEND(utf8_environ_ctx, utf8_environ, num_env, NULL);
// Avoid showing up in leak detectors etc.
atexit(free_env);
diff --git a/osdep/path-win.c b/osdep/path-win.c
index 3b104cac03..10884cb384 100644
--- a/osdep/path-win.c
+++ b/osdep/path-win.c
@@ -76,12 +76,19 @@ static char *mp_get_win_local_app_dir(void *talloc_ctx)
return path ? mp_path_join(talloc_ctx, path, "mpv") : NULL;
}
+static void path_uninit(void)
+{
+ TA_FREEP(&portable_path);
+}
+
static void path_init(void)
{
void *tmp = talloc_new(NULL);
char *path = mp_get_win_exe_subdir(tmp, "portable_config");
- if (path && mp_path_exists(path))
+ if (path && mp_path_exists(path)) {
portable_path = talloc_strdup(NULL, path);
+ atexit(path_uninit);
+ }
talloc_free(tmp);
}
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c
index 94d3e6085e..6f70548875 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -109,7 +109,7 @@ static const struct key_entry keys[] = {
{"\033[B", MP_KEY_DOWN},
{"\033[C", MP_KEY_RIGHT},
{"\033[D", MP_KEY_LEFT},
- {"\033[E", MP_KEY_KP5},
+ {"\033[E", MP_KEY_KPBEGIN},
{"\033[F", MP_KEY_END},
{"\033[H", MP_KEY_HOME},
diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c
index 435354155a..1c059ff688 100644
--- a/osdep/terminal-win.c
+++ b/osdep/terminal-win.c
@@ -632,6 +632,11 @@ void terminal_set_mouse_input(bool enable)
}
}
+static VOID NTAPI fls_free_cb(PVOID ptr)
+{
+ talloc_free(ptr);
+}
+
void terminal_init(void)
{
CONSOLE_SCREEN_BUFFER_INFO cinfo;
@@ -653,6 +658,6 @@ void terminal_init(void)
GetConsoleScreenBufferInfo(hSTDOUT, &cinfo);
stdoutAttrs = cinfo.wAttributes;
- tmp_buffers_key = FlsAlloc((PFLS_CALLBACK_FUNCTION)talloc_free);
+ tmp_buffers_key = FlsAlloc(fls_free_cb);
utf8_output = SetConsoleOutputCP(CP_UTF8);
}
diff --git a/osdep/terminal.h b/osdep/terminal.h
index 4174cf2d3b..1c63809f59 100644
--- a/osdep/terminal.h
+++ b/osdep/terminal.h
@@ -38,6 +38,8 @@
#define TERM_ESC_ENABLE_MOUSE "\033[?1003h"
#define TERM_ESC_DISABLE_MOUSE "\033[?1003l"
+#define TERM_ESC_GREY "\033[38;5;8m"
+
struct input_ctx;
/* Global initialization for terminal output. */
diff --git a/osdep/w32_keyboard.c b/osdep/w32_keyboard.c
index 57988ec0ec..109e751d9d 100644
--- a/osdep/w32_keyboard.c
+++ b/osdep/w32_keyboard.c
@@ -67,7 +67,7 @@ static const struct keymap vk_map[] = {
// numpad without numlock
{VK_INSERT, MP_KEY_KPINS}, {VK_END, MP_KEY_KPEND}, {VK_DOWN, MP_KEY_KPDOWN},
- {VK_NEXT, MP_KEY_KPPGDOWN}, {VK_LEFT, MP_KEY_KPLEFT}, {VK_CLEAR, MP_KEY_KP5},
+ {VK_NEXT, MP_KEY_KPPGDOWN}, {VK_LEFT, MP_KEY_KPLEFT}, {VK_CLEAR, MP_KEY_KPBEGIN},
{VK_RIGHT, MP_KEY_KPRIGHT}, {VK_HOME, MP_KEY_KPHOME}, {VK_UP, MP_KEY_KPUP},
{VK_PRIOR, MP_KEY_KPPGUP}, {VK_DELETE, MP_KEY_KPDEL},