From c01dfa3f83d32109ecf070efecceef21dbd6ba92 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 6 May 2015 01:19:27 -0700 Subject: [PATCH] SDL: Allocate properly sized input maps --- CHANGES | 1 + src/gba/input.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index bd71f8b81..9f569afdf 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ Bugfixes: - Video: Fix an issue with very long filenames - SDL: Fix boundary conditions for joystick adjustments - Util: Fix a null-pointer issue when attempting to delete a key + - SDL: Allocate properly sized input maps Misc: - Qt: Show multiplayer numbers in window title - Qt: Solar sensor can have shortcuts set diff --git a/src/gba/input.c b/src/gba/input.c index fbaf8c3e0..0b40e1f7b 100644 --- a/src/gba/input.c +++ b/src/gba/input.c @@ -95,7 +95,7 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t map->numMaps = 1; impl = &map->maps[0]; impl->type = type; - impl->map = calloc(GBA_KEY_MAX, sizeof(enum GBAKey)); + impl->map = calloc(GBA_KEY_MAX, sizeof(int)); TableInit(&impl->axes, 2, free); } else { impl = _lookupMap(map, type); @@ -110,7 +110,7 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t } if (impl) { impl->type = type; - impl->map = calloc(GBA_KEY_MAX, sizeof(enum GBAKey)); + impl->map = calloc(GBA_KEY_MAX, sizeof(int)); } else { map->maps = realloc(map->maps, sizeof(*map->maps) * map->numMaps * 2); for (m = map->numMaps * 2 - 1; m > map->numMaps; --m) { @@ -120,7 +120,7 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t map->numMaps *= 2; impl = &map->maps[m]; impl->type = type; - impl->map = calloc(GBA_KEY_MAX, sizeof(enum GBAKey)); + impl->map = calloc(GBA_KEY_MAX, sizeof(int)); } TableInit(&impl->axes, 2, free); }