qt: playlist: use item title if available
[vlc.git] / contrib / src / flac / console_write.patch
blob0a95534f10d29a394438f480d79b05e87a97fb7f
1 From 9d6fbddfd031852f7c6d1a10aff9fa5ef690858b Mon Sep 17 00:00:00 2001
2 From: Steve Lhomme <robux4@ycbcr.xyz>
3 Date: Fri, 3 Apr 2020 13:33:26 +0200
4 Subject: [PATCH 1/2] Don't call Console APIs on Winstore builds
6 The API's are only available on desktop builds.
7 https://docs.microsoft.com/en-us/windows/console/getstdhandle
8 https://docs.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo
9 https://docs.microsoft.com/en-us/windows/console/writeconsole
11 Instead send logs to the debug output
12 ---
13 src/share/win_utf8_io/win_utf8_io.c | 8 ++++++++
14 1 file changed, 8 insertions(+)
16 diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c
17 index bbb6a74a..1e0c1e86 100644
18 --- a/src/share/win_utf8_io/win_utf8_io.c
19 +++ b/src/share/win_utf8_io/win_utf8_io.c
20 @@ -34,6 +34,7 @@
21 #endif
23 #include <windows.h>
24 +#include <winapifamily.h>
25 #include "share/win_utf8_io.h"
26 #include "share/windows_unicode_filenames.h"
28 @@ -182,11 +183,13 @@ size_t strlen_utf8(const char *str)
29 int win_get_console_width(void)
31 int width = 80;
32 +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
33 CONSOLE_SCREEN_BUFFER_INFO csbi;
34 HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
35 if(hOut != INVALID_HANDLE_VALUE && hOut != NULL)
36 if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0)
37 width = csbi.dwSize.X;
38 +#endif
39 return width;
42 @@ -194,6 +197,10 @@ int win_get_console_width(void)
44 static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
46 +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
47 + (void)stream;
48 + OutputDebugStringW(text);
49 +#else
50 DWORD out;
51 int ret;
53 @@ -219,6 +226,7 @@ static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
54 ret = fputws(text, stream);
55 if (ret < 0)
56 return ret;
57 +#endif
58 return len;
61 --
62 2.26.0.windows.1