Codechange: use range-based for loops and let count be correct count

This commit is contained in:
Rubidium
2024-04-07 21:55:40 +02:00
committed by rubidium42
parent 4718971ccc
commit 62f5c595f3
4 changed files with 26 additions and 31 deletions
+5 -6
View File
@@ -378,8 +378,8 @@ struct SDLVkMapping {
uint8_t map_to;
};
#define AS(x, z) {x, 0, z}
#define AM(x, y, z, w) {x, (uint8_t)(y - x), z}
#define AS(x, z) {x, 1, z}
#define AM(x, y, z, w) {x, (uint8_t)(y - x + 1), z}
static const SDLVkMapping _vk_mapping[] = {
/* Pageup stuff + up/down */
@@ -435,12 +435,11 @@ static const SDLVkMapping _vk_mapping[] = {
static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, char32_t *character)
{
const SDLVkMapping *map;
uint key = 0;
for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
if ((uint)(sym->sym - map->vk_from) <= map->vk_count) {
key = sym->sym - map->vk_from + map->map_to;
for (const auto &map : _vk_mapping) {
if (IsInsideBS(sym, map.vk_from, map.vk_count)) {
key = sym->sym - map.vk_from + map.map_to;
break;
}
}