summaryrefslogtreecommitdiffstats
path: root/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/ports/libflac/uwp-library-console.patch
blob: 234758c754131df64595d0637e36b9b56a5c4149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c
index bbb6a74a..8b20bbb7 100644
--- a/src/share/win_utf8_io/win_utf8_io.c
+++ b/src/share/win_utf8_io/win_utf8_io.c
@@ -110,7 +110,11 @@ int get_utf8_argv(int *argc, char ***argv)
 	char **utf8argv;
 	int ret, i;
 
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+	if ((handle = LoadPackagedLibrary("msvcrt.dll", 0)) == NULL) return 1;
+#else
 	if ((handle = LoadLibraryW(L"msvcrt.dll")) == NULL) return 1;
+#endif
 	if ((wgetmainargs = (wgetmainargs_t)GetProcAddress(handle, "__wgetmainargs")) == NULL) {
 		FreeLibrary(handle);
 		return 1;
@@ -181,6 +185,9 @@ size_t strlen_utf8(const char *str)
 /* get the console width in characters */
 int win_get_console_width(void)
 {
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+	return 80;
+#else
 	int width = 80;
 	CONSOLE_SCREEN_BUFFER_INFO csbi;
 	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -188,6 +195,7 @@ int win_get_console_width(void)
 		if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0)
 			width = csbi.dwSize.X;
 	return width;
+#endif
 }
 
 /* print functions */
@@ -197,6 +205,10 @@ static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
 	DWORD out;
 	int ret;
 
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+	// disabled for UWP as there's no alternative:
+	// https://docs.microsoft.com/en-us/uwp/win32-and-com/alternatives-to-windows-apis-uwp
+#else
 	do {
 		if (stream == stdout) {
 			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -215,6 +227,7 @@ static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
 			return out;
 		}
 	} while(0);
+#endif
 
 	ret = fputws(text, stream);
 	if (ret < 0)