On Wed, Aug 6, 2025 at 3:56 PM <marcandre.lur...@redhat.com> wrote: > > From: William Hu via <qemu-devel@nongnu.org>
The pull request merging script rejects this pull request because the author's email address was mangled by the mailing list: ERROR: pull request includes commits attributed to list Please fix up the commit author's email address in your branch and send a v2 pull request. Thank you! Stefan > > Replace -1 comparisons for wint_t with WEOF to fix infinite loop caused by a > 65535 == -1 comparison. > > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2905 > Signed-off-by: William Hu <purplearmadill...@proton.me> > Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org> > Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> > [ Marc-André - Add missing similar code change ] > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > Message-ID: > <tSO5to8--iex6QMThG3Z8ElfnNOUahK_yitw2G2tEVRPoMKV936CBdrpyfbeNpVEpziKqeQ1ShBwPOoDkofgApM8YWwnPKJR_JrPDThV8Bc=@proton.me> > --- > ui/curses.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/ui/curses.c b/ui/curses.c > index a39aee8762..eccb585948 100644 > --- a/ui/curses.c > +++ b/ui/curses.c > @@ -265,7 +265,12 @@ static int curses2foo(const int _curses2foo[], const int > _curseskey2foo[], > > static void curses_refresh(DisplayChangeListener *dcl) > { > - int chr, keysym, keycode, keycode_alt; > + /* > + * DO NOT MAKE chr AN INT: > + * Causes silent conversion errors on Windows where wint_t is unsigned > short. > + */ > + wint_t chr = 0; > + int keysym, keycode, keycode_alt; > enum maybe_keycode maybe_keycode = CURSES_KEYCODE; > > curses_winch_check(); > @@ -284,8 +289,9 @@ static void curses_refresh(DisplayChangeListener *dcl) > /* while there are any pending key strokes to process */ > chr = console_getch(&maybe_keycode); > > - if (chr == -1) > + if (chr == WEOF) { > break; > + } > > #ifdef KEY_RESIZE > /* this shouldn't occur when we use a custom SIGWINCH handler */ > @@ -304,9 +310,9 @@ static void curses_refresh(DisplayChangeListener *dcl) > /* alt or esc key */ > if (keycode == 1) { > enum maybe_keycode next_maybe_keycode = CURSES_KEYCODE; > - int nextchr = console_getch(&next_maybe_keycode); > + wint_t nextchr = console_getch(&next_maybe_keycode); > > - if (nextchr != -1) { > + if (nextchr != WEOF) { > chr = nextchr; > maybe_keycode = next_maybe_keycode; > keycode_alt = ALT; > -- > 2.50.1 > >