Windows: Fixed ignoring return value of internal function.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Fri, 06 Mar 2015 21:34:10 +0100
changeset 9379ff0e77a2f48c
parent 9378 71743b696c06
child 9380 07b7c1005a23
Windows: Fixed ignoring return value of internal function.

If the function WIN_ConvertUTF32toUTF8() failed (should currently not be
possible) a not terminated string would have been sent as text input event.

This also fixed converting characters more often than needed on key repetition.
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Fri Mar 06 21:29:25 2015 +0100
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Fri Mar 06 21:34:10 2015 +0100
     1.3 @@ -559,10 +559,11 @@
     1.4  
     1.5              GetKeyboardState(keyboardState);
     1.6              if (ToUnicode(wParam, (lParam >> 16) & 0xff, keyboardState, (LPWSTR)&utf32, 1, 0) > 0) {
     1.7 -                WORD repetition;
     1.8 -                for (repetition = lParam & 0xffff; repetition > 0; repetition--) {
     1.9 -                    WIN_ConvertUTF32toUTF8(utf32, text);
    1.10 -                    SDL_SendKeyboardText(text);
    1.11 +                if (WIN_ConvertUTF32toUTF8(utf32, text)) {
    1.12 +                    WORD repetition;
    1.13 +                    for (repetition = lParam & 0xffff; repetition > 0; repetition--) {
    1.14 +                        SDL_SendKeyboardText(text);
    1.15 +                    }
    1.16                  }
    1.17              }
    1.18          }