forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contribs: improve flac support on WinRT
- Loading branch information
Showing
1 changed file
with
31 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
--- flac/src/share/win_utf8_io/win_utf8_io.c.orig 2016-05-13 11:27:58.508525189 +0200 | ||
+++ flac/src/share/win_utf8_io/win_utf8_io.c 2016-05-13 12:16:51.951811662 +0200 | ||
@@ -162,33 +162,14 @@ | ||
/* get the console width in characters */ | ||
--- flac.orig/src/share/win_utf8_io/win_utf8_io.c 2016-05-16 14:52:36.408520025 +0200 | ||
+++ flac/src/share/win_utf8_io/win_utf8_io.c 2016-05-16 14:57:07.880507930 +0200 | ||
@@ -42,6 +42,7 @@ | ||
#include <stdarg.h> | ||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> /* for WideCharToMultiByte and MultiByteToWideChar */ | ||
+#include <winapifamily.h> | ||
|
||
#include "share/win_utf8_io.h" | ||
|
||
@@ -163,16 +164,22 @@ | ||
int win_get_console_width(void) | ||
{ | ||
- int width = 80; | ||
- CONSOLE_SCREEN_BUFFER_INFO csbi; | ||
- HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); | ||
- if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0) width = csbi.dwSize.X; | ||
- return width; | ||
+ return 80; | ||
int width = 80; | ||
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) | ||
CONSOLE_SCREEN_BUFFER_INFO csbi; | ||
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); | ||
if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0) width = csbi.dwSize.X; | ||
+#endif | ||
return width; | ||
} | ||
|
||
/* print functions */ | ||
- | ||
int print_console(FILE *stream, const wchar_t *text, size_t len) | ||
{ | ||
- static HANDLE hOut; | ||
- static HANDLE hErr; | ||
- DWORD out; | ||
- hOut = GetStdHandle(STD_OUTPUT_HANDLE); | ||
- hErr = GetStdHandle(STD_ERROR_HANDLE); | ||
- if (stream == stdout && hOut != INVALID_HANDLE_VALUE && GetFileType(hOut) == FILE_TYPE_CHAR) { | ||
- if (WriteConsoleW(hOut, text, len, &out, NULL) == 0) return -1; | ||
- return out; | ||
- } else if (stream == stderr && hErr != INVALID_HANDLE_VALUE && GetFileType(hErr) == FILE_TYPE_CHAR) { | ||
- if (WriteConsoleW(hErr, text, len, &out, NULL) == 0) return -1; | ||
- return out; | ||
- } else { | ||
- int ret = fputws(text, stream); | ||
- if (ret < 0) return ret; | ||
- return len; | ||
- } | ||
+ (void)stream, (void)text; | ||
+ return len; | ||
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) | ||
+ (void)stream; | ||
+ OutputDebugStringW(text); | ||
+ return len; | ||
+#else | ||
static HANDLE hOut; | ||
static HANDLE hErr; | ||
DWORD out; | ||
@@ -189,6 +196,7 @@ | ||
if (ret < 0) return ret; | ||
return len; | ||
} | ||
+#endif | ||
} | ||
|
||
int printf_utf8(const char *format, ...) |