[vlc-devel] [PATCH] contrib: flac: update the winstore fixes for 1.3.3

Jean-Baptiste Kempf jb at videolan.org
Thu Apr 30 13:00:09 CEST 2020


OK

On Thu, Apr 30, 2020, at 12:32, Steve Lhomme wrote:
> ---
>  contrib/src/flac/console_write.patch  | 37 ++++++++++----
>  contrib/src/flac/no-createfilea.patch | 69 ++++++++-------------------
>  2 files changed, 48 insertions(+), 58 deletions(-)
> 
> diff --git a/contrib/src/flac/console_write.patch 
> b/contrib/src/flac/console_write.patch
> index 8015fd49701..0a95534f10d 100644
> --- a/contrib/src/flac/console_write.patch
> +++ b/contrib/src/flac/console_write.patch
> @@ -1,5 +1,22 @@
> ---- flac.orig/src/share/win_utf8_io/win_utf8_io.c	2017-01-02 
> 18:07:08.794676209 -0500
> -+++ flac/src/share/win_utf8_io/win_utf8_io.c	2017-01-02 
> 18:10:16.633867994 -0500
> +From 9d6fbddfd031852f7c6d1a10aff9fa5ef690858b Mon Sep 17 00:00:00 2001
> +From: Steve Lhomme <robux4 at ycbcr.xyz>
> +Date: Fri, 3 Apr 2020 13:33:26 +0200
> +Subject: [PATCH 1/2] Don't call Console APIs on Winstore builds
> +
> +The API's are only available on desktop builds.
> +https://docs.microsoft.com/en-us/windows/console/getstdhandle
> +https://docs.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo
> +https://docs.microsoft.com/en-us/windows/console/writeconsole
> +
> +Instead send logs to the debug output
> +---
> + src/share/win_utf8_io/win_utf8_io.c | 8 ++++++++
> + 1 file changed, 8 insertions(+)
> +
> +diff --git a/src/share/win_utf8_io/win_utf8_io.c 
> b/src/share/win_utf8_io/win_utf8_io.c
> +index bbb6a74a..1e0c1e86 100644
> +--- a/src/share/win_utf8_io/win_utf8_io.c
> ++++ b/src/share/win_utf8_io/win_utf8_io.c
>  @@ -34,6 +34,7 @@
>   #endif
>   
> @@ -8,7 +25,7 @@
>   #include "share/win_utf8_io.h"
>   #include "share/windows_unicode_filenames.h"
>   
> -@@ -164,11 +165,13 @@
> +@@ -182,11 +183,13 @@ size_t strlen_utf8(const char *str)
>   int win_get_console_width(void)
>   {
>   	int width = 80;
> @@ -22,23 +39,25 @@
>   	return width;
>   }
>   
> -@@ -176,6 +179,11 @@
> +@@ -194,6 +197,10 @@ int win_get_console_width(void)
>   
>   static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
>   {
> -+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
> ++#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
>  +	(void)stream;
>  +	OutputDebugStringW(text);
> -+	return len;
>  +#else
>   	DWORD out;
>   	int ret;
>   
> -@@ -202,6 +210,7 @@
> +@@ -219,6 +226,7 @@ static int wprint_console(FILE *stream, const 
> wchar_t *text, size_t len)
> + 	ret = fputws(text, stream);
>   	if (ret < 0)
>   		return ret;
> - 	return len;
>  +#endif
> + 	return len;
>   }
>   
> - int printf_utf8(const char *format, ...)
> +-- 
> +2.26.0.windows.1
> +
> diff --git a/contrib/src/flac/no-createfilea.patch 
> b/contrib/src/flac/no-createfilea.patch
> index b66f96d8e84..2831b0a79b0 100644
> --- a/contrib/src/flac/no-createfilea.patch
> +++ b/contrib/src/flac/no-createfilea.patch
> @@ -1,59 +1,30 @@
> ---- flac-orig/src/share/win_utf8_io/win_utf8_io.c	2019-08-26 
> 11:13:17.600801754 -0400
> -+++ flac/src/share/win_utf8_io/win_utf8_io.c	2019-08-26 
> 11:20:27.895132487 -0400
> -@@ -34,8 +34,10 @@
> - #endif
> - 
> - #include <windows.h>
> -+#include <winapifamily.h>
> - #include "share/win_utf8_io.h"
> - #include "share/windows_unicode_filenames.h"
> -+#include <winapifamily.h>
> - 
> - #define UTF8_BUFFER_SIZE 32768
> - 
> -@@ -153,7 +155,11 @@
> +From 11390430fbad4a0d5a70671f922bd374defc715b Mon Sep 17 00:00:00 2001
> +From: Steve Lhomme <robux4 at ycbcr.xyz>
> +Date: Fri, 3 Apr 2020 13:25:14 +0200
> +Subject: [PATCH 2/2] Don't call CreateFileA on Winstore builds
> +
> +The API is only available on desktop builds.
> +https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea
> +---
> + src/share/win_utf8_io/win_utf8_io.c | 4 ++++
> + 1 file changed, 4 insertions(+)
> +
> +diff --git a/src/share/win_utf8_io/win_utf8_io.c 
> b/src/share/win_utf8_io/win_utf8_io.c
> +index 1e0c1e86..e634efd9 100644
> +--- a/src/share/win_utf8_io/win_utf8_io.c
> ++++ b/src/share/win_utf8_io/win_utf8_io.c
> +@@ -154,7 +154,11 @@ int get_utf8_argv(int *argc, char ***argv)
>   HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD 
> dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES 
> lpSecurityAttributes, DWORD dwCreationDisposition, DWORD 
> dwFlagsAndAttributes, HANDLE hTemplateFile)
>   {
>   	if (!flac_internal_get_utf8_filenames()) {
>  +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 
>   		return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, 
> lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, 
> hTemplateFile);
>  +#else
> -+        return INVALID_HANDLE_VALUE;
> ++		return INVALID_HANDLE_VALUE;
>  +#endif
>   	} else {
>   		wchar_t *wname;
>   		HANDLE handle = INVALID_HANDLE_VALUE;
> -@@ -182,11 +188,13 @@
> - int win_get_console_width(void)
> - {
> - 	int width = 80;
> -+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
> - 	CONSOLE_SCREEN_BUFFER_INFO csbi;
> - 	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
> - 	if(hOut != INVALID_HANDLE_VALUE && hOut != NULL)
> - 		if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0)
> - 			width = csbi.dwSize.X;
> -+#endif
> - 	return width;
> - }
> - 
> -@@ -194,6 +202,11 @@
> - 
> - static int wprint_console(FILE *stream, const wchar_t *text, size_t 
> len)
> - {
> -+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
> -+	(void)stream;
> -+	OutputDebugStringW(text);
> -+	return len;
> -+#else
> - 	DWORD out;
> - 	int ret;
> - 
> -@@ -220,6 +233,7 @@
> - 	if (ret < 0)
> - 		return ret;
> - 	return len;
> -+#endif
> - }
> - 
> - int printf_utf8(const char *format, ...)
> +-- 
> +2.26.0.windows.1
> +
> -- 
> 2.17.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list