From bd6de4f642ed81f6fa32565b1324003857f4bf45 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 11 Oct 2009 13:44:19 +0000 Subject: 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 --- gui/ListWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') 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. -- cgit v1.2.3