PR #22452 opened by nyanmisaka
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22452
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22452.patch

fixup 08d327e

When an uchar is set to -1, it will become 255 when read as an int.
Duplicate variables for two terminal types can also avoid unused variable 
warnings.

Signed-off-by: nyanmisaka <[email protected]>


>From e8cd273ca6b715b859008d8184cd493a63fc5106 Mon Sep 17 00:00:00 2001
From: nyanmisaka <[email protected]>
Date: Mon, 9 Mar 2026 17:31:48 +0800
Subject: [PATCH] fftools/ffmpeg: fix read_key() always return 255 when there
 was no input

fixup 08d327e

When an uchar is set to -1, it will become 255 when read as an int.
Duplicate variables for two terminal types can also avoid unused variable 
warnings.

Signed-off-by: nyanmisaka <[email protected]>
---
 fftools/ffmpeg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index c2c85d46bd..7f386bb3f3 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -253,8 +253,8 @@ void term_init(void)
 /* read a key without blocking */
 static int read_key(void)
 {
-    unsigned char ch = -1;
 #if HAVE_TERMIOS_H
+    unsigned char ch;
     int n = 1;
     struct timeval tv;
     fd_set rfds;
@@ -273,6 +273,7 @@ static int read_key(void)
     }
 #elif HAVE_KBHIT
 #    if HAVE_PEEKNAMEDPIPE && HAVE_GETSTDHANDLE
+    unsigned char ch;
     static int is_pipe;
     static HANDLE input_handle;
     DWORD dw, nchars;
@@ -300,7 +301,7 @@ static int read_key(void)
     if(kbhit())
         return(getch());
 #endif
-    return ch;
+    return -1;
 }
 
 static int decode_interrupt_cb(void *ctx)
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to