aboutsummaryrefslogtreecommitdiff
path: root/ports/libflac/uwp-library-console.patch
diff options
context:
space:
mode:
authorAlexander Karatarakis <alex@karatarakis.com>2017-11-21 01:03:35 -0800
committerGitHub <noreply@github.com>2017-11-21 01:03:35 -0800
commit9d93342017a8c06d87c6c90341d6261ccefe2e46 (patch)
tree60bde4e73361fee4c51430a7d53714e0ce0d3980 /ports/libflac/uwp-library-console.patch
parent7604a246daab900b7472828fdac32f021c1b1ae3 (diff)
parent38ae2f69b7f376614f6a4b9201a23fcaa228baf9 (diff)
downloadvcpkg-9d93342017a8c06d87c6c90341d6261ccefe2e46.tar.gz
vcpkg-9d93342017a8c06d87c6c90341d6261ccefe2e46.zip
Merge pull request #2214 from aybe/libflac-uwp
[libflac] patches for UWP builds
Diffstat (limited to 'ports/libflac/uwp-library-console.patch')
-rw-r--r--ports/libflac/uwp-library-console.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/ports/libflac/uwp-library-console.patch b/ports/libflac/uwp-library-console.patch
new file mode 100644
index 000000000..bba2422c3
--- /dev/null
+++ b/ports/libflac/uwp-library-console.patch
@@ -0,0 +1,53 @@
+diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c
+index c61d27f..0870054 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 = LoadLibrary("msvcrt.dll")) == NULL) return 1;
++#endif
+ if ((wgetmainargs = (wgetmainargs_t)GetProcAddress(handle, "__wgetmainargs")) == NULL) {
+ FreeLibrary(handle);
+ return 1;
+@@ -163,6 +167,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);
+@@ -170,6 +177,7 @@ int win_get_console_width(void)
+ if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0)
+ width = csbi.dwSize.X;
+ return width;
++#endif
+ }
+
+ /* print functions */
+@@ -179,6 +187,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);
+@@ -197,6 +209,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)