Mercurial > sdl-ios-xcode
comparison src/video/bwindow/SDL_BWin.h @ 1614:6162b8d921ce
Date: Wed, 29 Mar 2006 17:26:55 +0200 CEST
From: "Fran���is Revol"
Subject: [SDL] BeOS port fix: PrintScreen key crashing
It seems the latest SDL crashes when someone hits the PrtScrn key in
ZETA (BeOS R6), somewhere it gets a negative value as key code (or a
big unsigned maybe ?), and uses it as an index in the keysym table...
I'll investigate the cause for the negative value, but it's always
better to check for bounds correctly when indexing a table. The
attached diff fixes it.
Fran���is Revol
--
Software Architect
yellowTAB GmbH
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 31 Mar 2006 06:16:20 +0000 |
parents | e440d5c488c1 |
children | e49147870aac c121d94672cb 678576473849 |
comparison
equal
deleted
inserted
replaced
1613:2095da6364c9 | 1614:6162b8d921ce |
---|---|
476 break; | 476 break; |
477 | 477 |
478 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) { | 478 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) { |
479 SDL_keysym keysym; | 479 SDL_keysym keysym; |
480 keysym.scancode = key; | 480 keysym.scancode = key; |
481 if (key < 128) { | 481 if ((key > 0) && (key < 128)) { |
482 keysym.sym = keymap[key]; | 482 keysym.sym = keymap[key]; |
483 } else { | 483 } else { |
484 keysym.sym = SDLK_UNKNOWN; | 484 keysym.sym = SDLK_UNKNOWN; |
485 } | 485 } |
486 /* FIX THIS? | 486 /* FIX THIS? |
509 int32 key; | 509 int32 key; |
510 int32 modifiers; | 510 int32 modifiers; |
511 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) { | 511 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) { |
512 SDL_keysym keysym; | 512 SDL_keysym keysym; |
513 keysym.scancode = key; | 513 keysym.scancode = key; |
514 if (key < 128) { | 514 if ((key > 0) && (key < 128)) { |
515 keysym.sym = keymap[key]; | 515 keysym.sym = keymap[key]; |
516 } else { | 516 } else { |
517 keysym.sym = SDLK_UNKNOWN; | 517 keysym.sym = SDLK_UNKNOWN; |
518 } | 518 } |
519 keysym.mod = KMOD_NONE; /* FIX THIS? */ | 519 keysym.mod = KMOD_NONE; /* FIX THIS? */ |