Skip to content

Commit

Permalink
Windows: Fixed ignoring return value of internal function.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
philippwiesemann committed Mar 6, 2015
1 parent 8f4c2a8 commit 060d243
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/video/windows/SDL_windowsevents.c
Expand Up @@ -559,10 +559,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

GetKeyboardState(keyboardState);
if (ToUnicode(wParam, (lParam >> 16) & 0xff, keyboardState, (LPWSTR)&utf32, 1, 0) > 0) {
WORD repetition;
for (repetition = lParam & 0xffff; repetition > 0; repetition--) {
WIN_ConvertUTF32toUTF8(utf32, text);
SDL_SendKeyboardText(text);
if (WIN_ConvertUTF32toUTF8(utf32, text)) {
WORD repetition;
for (repetition = lParam & 0xffff; repetition > 0; repetition--) {
SDL_SendKeyboardText(text);
}
}
}
}
Expand Down

0 comments on commit 060d243

Please sign in to comment.