diff mbox series

[FFmpeg-devel] fftools: Check HAVE_GETSTDHANDLE before using GetStdHandle

Message ID 20231022110844.453767-1-martin@martin.st
State Accepted
Commit ff5a3575fec2d49d5fae4ec1198a939e203314db
Headers show
Series [FFmpeg-devel] fftools: Check HAVE_GETSTDHANDLE before using GetStdHandle | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Martin Storsjö Oct. 22, 2023, 11:08 a.m. UTC
GetStdHandle is unavailable outside of the desktop API subset.

This didn't use to be a problem with earlier WinSDKs, as kbhit also
used to be available only for desktop apps, and this whole section is
wrapped in #if HAVE_KBHIT. With newer WinSDKs, kbhit() is available also
for non-desktop apps, while GetStdHandle still isn't.
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anton Khirnov Oct. 23, 2023, 10:04 a.m. UTC | #1
Quoting Martin Storsjö (2023-10-22 13:08:44)
> GetStdHandle is unavailable outside of the desktop API subset.
> 
> This didn't use to be a problem with earlier WinSDKs, as kbhit also
> used to be available only for desktop apps, and this whole section is
> wrapped in #if HAVE_KBHIT. With newer WinSDKs, kbhit() is available also
> for non-desktop apps, while GetStdHandle still isn't.
> ---
>  fftools/ffmpeg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 7c33b56cd3..46a85b41a8 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -308,7 +308,7 @@  static int read_key(void)
         return n;
     }
 #elif HAVE_KBHIT
-#    if HAVE_PEEKNAMEDPIPE
+#    if HAVE_PEEKNAMEDPIPE && HAVE_GETSTDHANDLE
     static int is_pipe;
     static HANDLE input_handle;
     DWORD dw, nchars;