diff options
author | Johannes Schickel | 2009-10-11 13:44:19 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-10-11 13:44:19 +0000 |
commit | bd6de4f642ed81f6fa32565b1324003857f4bf45 (patch) | |
tree | 8b9574351e789dd29e2737c7df1f4b822f31986c /gui | |
parent | f4288516e80ec64aa262ccd8fcf61b1f8ce3fa09 (diff) | |
download | scummvm-rg350-bd6de4f642ed81f6fa32565b1324003857f4bf45.tar.gz scummvm-rg350-bd6de4f642ed81f6fa32565b1324003857f4bf45.tar.bz2 scummvm-rg350-bd6de4f642ed81f6fa32565b1324003857f4bf45.zip |
Hopefully avoiding an assert in the MSVC debug CRT library when entering an umlaut in the launcher.
It's a bad idea to cast a parameter to the "is*" functions from ctype.h to "char",
since "char" might be signed and the "is*" functions are defined to only accept
input which fits "unsigned char" or equals EOF. In this concrete example the value
of "state.ascii" is > 0x7F, thus becomes negative after the cast to "char", which
violates the parameter rules of "isprint".
Sadly it seems this is not the only place in our code, which does pass a possibly
signed parameter to an "is*" function. We might either want to change all code to
only pass an unsigned char value, change the code to do parameter validation or
fix it in another way.
svn-id: r44920
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ListWidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index b71bb4701e..b1e333b1bb 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -286,7 +286,7 @@ bool ListWidget::handleKeyDown(Common::KeyState state) { bool dirty = false; int oldSelectedItem = _selectedItem; - if (!_editMode && isprint((char)state.ascii)) { + if (!_editMode && isprint((unsigned char)state.ascii)) { // Quick selection mode: Go to first list item starting with this key // (or a substring accumulated from the last couple key presses). // Only works in a useful fashion if the list entries are sorted. |