1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Fixed signed/unsigned comparison and potential negative table reference.

This commit is contained in:
Thomas Harte 2017-07-21 20:45:49 -04:00
parent 2a7fc86b15
commit 2471ef805b

View File

@ -148,9 +148,10 @@ uint16_t *ZX8081::Machine::sequence_for_character(Utility::Typer *typer, char ch
#undef SHIFT
#undef X
if(character > sizeof(zx81_key_sequences) / sizeof(*zx81_key_sequences)) return nullptr;
size_t ucharacter = (size_t)character;
if(ucharacter > sizeof(zx81_key_sequences) / sizeof(*zx81_key_sequences)) return nullptr;
KeyTable *table = is_zx81_ ? &zx81_key_sequences : &zx80_key_sequences;
if((*table)[character][0] == NotMapped) return nullptr;
return (uint16_t *)(*table)[character];
if((*table)[ucharacter][0] == NotMapped) return nullptr;
return (uint16_t *)(*table)[ucharacter];
}